[C++-sig] held_ptr and polymorphism

David Abrahams dave at boost-consulting.com
Wed May 24 13:38:14 CEST 2006


"Garrick Chin" <nonexistent.ftp at gmail.com> writes:

> I compiled the \python\test\polymorphism2.cpp with and without
> HELD_BY_AUTO_PTR defined to toggle holding the C++ defined Python
> objects with and without std::auto_ptr into two separate modules:
>
> polymorphism2_ext
> polymorphism2_auto_ptr_ext
>
> I ran the following test:
>
> class ADerived(A):
>     def f(self):
>         return "ADerived::f()"
>
> call_f(ADerived())
>
> with
>
> two different imports: "from polymoprhism2_ext import" and "from
> polymoprhism2_auto_ptr_ext import"
>
> With the non-auto_ptr module, call_f() correctly prints
> "ADerived::f()".  _With_ the auto_ptr module, call_f() incorrectly
> prints  "A::f()".  Is this a bug?  How does one store particular C++
> defined Python objects in a smart pointer without losing polymorphic
> behavior?

What is your platform and compiler?
http://engineering.meta-comm.com/boost-regression/1_33_1/developer/python_release.html
shows clearly that both tests were passing on all the combinations we
tested.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list