temporary auto_ptr

John Love-Jensen eljay@adobe.com
Thu Sep 29 13:34:00 GMT 2005


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



More information about the Gcc-help mailing list