[C++-sig] std::tr1::shared_ptr as boost::shared_ptr

Roman Yakovenko roman.yakovenko at gmail.com
Fri Apr 20 19:26:43 CEST 2007


On 4/20/07, Piotr Jaroszynski <p.jaroszynski at gmail.com> wrote:
>
> On Friday 20 of April 2007 18:53:32 Roman Yakovenko wrote:
> > There is no implicit conversion from a base class to the dervied.
> > The other way will work:
> >
> > bp::implicitly_convertible<std::tr1::shared_ptr<Derived>,
> > std::tr1::shared_ptr<Foo> >();
>
> Err I made a "typo", that's what I meant as a work around. What I asked
> about
> was whether it's possible to make it work exactly as with
> boost::shared_ptr,
> so:
> func(std::tr1::shared_ptr<Foo>) ...
> bp::class_<Foo> ...
> bp::class_<Derived, bp::bases<Foo> > ...
>
> and func can take both Foo and Derived.
>
> I suppose it's a matter of making some "mirror" templates for
> std::tr1::shared_ptr so boost.python will treat it exactly as it treats
> boost::shared_ptr.


 I am not sure. What you can do is to search Boost.Python library for
shared_ptr usage.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20070420/e2d290b4/attachment.htm>


More information about the Cplusplus-sig mailing list