[C++-sig] Re: discard reference
David Abrahams
dave at boost-consulting.com
Sat Sep 13 03:09:35 CEST 2003
"Mike Rovner" <mike at nospam.com> writes:
> David Abrahams wrote:
>> "Mike Rovner" <mike at nospam.com> writes:
>>
>>> class B
>>> {
>>> void set_new_owner(A* a) { ... }
>>> };
>
>>> - in Python: b.set_new_owner(AA(1))
>
>>> void set_new_owner_wrap(B& b, auto_ptr<A*> a) {
> ------------------------------------------------^^^
>>> Now the problem: there is no autoconvertion from AA* to auto_ptr<A>.
>>> What will be the correct way to solve the problem?
>>
>> Why is that a problem? I don't see any A* in wrapped function
>> signatures or returns here,
>
> Wrapper signature is (_1, ap<A*>)
> and I'm calling with AA* (or ap<AA> - doesn't work either).
>
> And if I set wrapper as (_1, ap<AA*>) I'll loose ability to polimorf derived
> classes
> and will have to write wrappers for each derived class individually which is
> inelegant.
Oh, I completely overlooked that. Do you really intend to use
auto_ptr<A*>? Those point at A* objects, not at A objects.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list