[C++-sig] Getting the wrapped C++ instance from a boost::python::object
Murray Cumming
murrayc at murrayc.com
Sat Feb 6 20:57:42 CET 2010
On Sat, 2010-02-06 at 12:54 -0500, Stefan Seefeld wrote:
> On 02/06/2010 08:39 AM, Murray Cumming wrote:
> > If I have a boost::python::object that I know contains a PyObject that
> > wraps an instance of my C++ class, MyClass, can I get a pointer to that
> > MyClass instance, so I can call its C++ methods?
> >
>
> http://www.boost.org/doc/libs/1_41_0/libs/python/doc/tutorial/doc/html/python/object.html#python.extracting_c___objects
So you are suggesting that I can do
boost::python::extract<MyClass*> extractor(obj);
if(extractor.check())
{
MyClass* myclass = extractor;
}
?
Thanks.
--
murrayc at murrayc.com
www.murrayc.com
www.openismus.com
More information about the Cplusplus-sig
mailing list