|
Boost : |
Subject: Re: [boost] enable_shared_from_this2
From: Berserker (berserker_r_at_[hidden])
Date: 2009-11-05 03:06:18
News about this problem?
I just checked the latest svn revision and it seems that the code below
doesn't work yet.
Berserker wrote:
> 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()
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk