[C++-sig] Re: discard reference

Mike Rovner mike at nospam.com
Sat Sep 13 00:15:53 CEST 2003


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.

Mike







More information about the Cplusplus-sig mailing list