This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: temporary auto_ptr


Hi Dima,

> At least I don't see any options for multiple implicit conversion here. It
seems to be one and single.

I see three implicit conversions.

std::auto_ptr<const A>::auto_ptr(std::auto_ptr_ref<const A>)
 ... via the operator cast
std::auto_ptr<const A>::auto_ptr(std::auto_ptr<const A>&)
 ... by template constructor
std::auto_ptr<const A>::auto_ptr(std::auto_ptr<const A>&)
 ... by copy constructor

The "perfect match" would be...
std::auto_ptr<const A>::auto_ptr(std::auto_ptr<const A>)
 ... but that does not exist.

> I don't see neither multiple paths to do the conversion,nor sequence of
conversions that require more than one cast.

See above.

The real issue is that a std::auto_ptr<const B> is *NOT* a
std::auto_ptr<const A>, since std::auto_ptr<const B> is *NOT* derived from
std::auto_ptr<const A>.  The former is not interchangeable with the latter.

HTH,
--Eljay


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]