[C++-sig] wrapping virtual base class with std::auto_ptr
David Abrahams
dave at boost-consulting.com
Fri May 13 14:13:31 CEST 2005
Faheem Mitha <faheem at email.unc.edu> writes:
> Hi,
>
> Consider the following simple example. This works fine if (for
> example) I replace std:auto_ptr<int> with int (see commented-put
> lines). This also works if this is just a regular struct (if f is a
> normal function returning a std::auto::ptr<int>).
>
> The compiler errors I get appear below. The offending line is.
>
> return this->get_override("f")();
>
> I have a dim understanding of how Boost.Python works in general, but
> really don't understand what magic goes on in wrapping virtual
> functions etc. I've just copied the syntax below from the tutorial.
>
> Thanks in advance for help. Please cc me; I'm not subscribed.
>
> Faheem.
>
> ap.cc: In member function `virtual std::auto_ptr<int> BaseWrap::f(int)':
I think this has more to do with auto_ptr than with Boost.Python. Try
changing:
std::auto_ptr<int> f(int val)
{
return this->get_override("f")();
}
into:
std::auto_ptr<int> f(int val)
{
std::auto_ptr<int> r( this->get_override("f")() );
return r;
}
HTH,
Dave
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list