[C++-sig] Re: Inheritance with B/P

Bruce Lowery bruce_lowery at yahoo.com
Mon Feb 10 18:52:09 CET 2003


--- David Abrahams <dave at boost-consulting.com> wrote:
> Bruce Lowery <bruce_lowery at yahoo.com> writes:
> 
> >> > Is there a better way to do this?
> >> 
> >> Does 
> >> 
> >>      implicitly_convertible<
> >>          std::auto_ptr<Derived>
> >>        , std::auto_ptr<Base>
> >>      >();
> >> 
> >> , placed in your module init function, help?
> >> 
> >
> > Although this would be an improvement over what I'm doing now, it still
> > requires a 'implicitly_convertible' for each derived class, doesn't it?  
> 
> Yep.  I could try to create auto_ptr conversions automatically, but
> the system is designed to work on all kinds of smart pointer and
> generalizing the mechanism would be very difficult.  Maybe I shouldn't
> worry about that.
> 


Perhaps a better way is to avoid the use of auto_ptr altogether.  Recall that I
needed to use it because I'm wrapping some methods that take ownership of a
passed-in pointer.  Is it possible to invent a new policy to represent this
semantic information and that would cause b/p to set 'thisown=0' on the python
object wrapping the pointer?  


Bruce Lowery

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com




More information about the Cplusplus-sig mailing list