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

Piotr Jaroszynski p.jaroszynski at gmail.com
Fri Apr 20 19:21:41 CEST 2007


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.

-- 
Best Regards,
Piotr Jaroszynski



More information about the Cplusplus-sig mailing list