[C++-sig] boost::variant and boost::python::extract

2013-05-08 Thread Bryan Catanzaro
Hi - Using Boost 1.53.0, the following code fails to compile with g++, when c++11 is enabled: #include #include struct A{}; struct B{}; typedef boost::variant my_variant; void foo(boost::python::object o) { my_variant v = boost::python::extract(o); } The error is: /home/bcatanzaro/boost_

Re: [C++-sig] boost::python::extract and boost::variant

2013-05-07 Thread Bryan Catanzaro
Thanks Jim, adding the extra parentheses solved the problem. I'll contact the Boost.Variant people. - bryan On Tue, May 7, 2013 at 4:28 PM, Jim Bosch wrote: > On 05/07/2013 07:19 PM, Bryan Catanzaro wrote: > >> Hi - >> Using Boost 1.53.0, the following code fails to

[C++-sig] boost::python::extract and boost::variant

2013-05-07 Thread Bryan Catanzaro
Hi - Using Boost 1.53.0, the following code fails to compile with g++, when c++11 is enabled: #include #include struct A{}; struct B{}; typedef boost::variant my_variant; void foo(boost::python::object o) { my_variant v = boost::python::extract(o); } The error is: /home/bcatanzaro/boost_

Re: [C++-sig] weak_ptr to this in C++ classes extended from python

2012-04-26 Thread Bryan Catanzaro
+ type: > boost::shared_ptr >   class_, boost::noncopyable >>("A", init<>()) > #endif >     .def("ptr", &A::ptr) >     .def("foo", &A::foo) >     ; > } > --- > >  foo.py   > imp

Re: [C++-sig] weak_ptr to this in C++ classes extended from python

2012-04-26 Thread Bryan Catanzaro
Holger Brandsmeier gmx.de> writes: > > Dear list, > > how is it possible to have a class in C++ that can be extended from > python and that stores a weak_ptr to itself? Have you tried using boost::enable_shared_from_this? The following example code seems to do what you want. f