|
Boost : |
Subject: Re: [boost] enable_shared_from_this2
From: Berserker (berserker_r_at_[hidden])
Date: 2009-10-28 11:17:39
The expirity check seems working fine to me if merged in
enable_shared_ptr2 and solves some problems.
I can summarize other boost::python's problems in this example:
class X : public boost::enable_shared_from_this2<X>
{
public:
void test()
{
shared_ptr<X> me = shared_from_this();
BOOST_ASSERT(me);
}
};
void expose_x()
{
boost::python::class_<X>("X", boost::python::init<>()).
def("test", &X::test);
}
------------------------------------
C++ case 1 (works fine):
shared_ptr<X> x(new X);
x->test();
------------------------------------
C++ case 2 (doesn't work because of the missing static/dynamic cast):
X x;
x.test();
------------------------------------
Python case (doesn't work, same problem of C++ case 2)
x = X()
x.test()
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk