[C++-sig] held_ptr and polymorphism

Garrick Chin nonexistent.ftp at gmail.com
Sun May 28 17:34:20 CEST 2006


On 5/24/06, David Abrahams <dave at boost-consulting.com> wrote:
> "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
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>

I wiped my test project and created a new one from scratch to retest
and the tests work correctly now, held and not held by auto_ptr.  The
previous project settings may have been messed up somehow, I'm not
sure.  Anyway, it works fine now.  Sorry for the false alarm!



More information about the Cplusplus-sig mailing list