After reading Jossutis’ explanation on auto_ptr from his STL book I’ve got a strong impression that whatever task I would try to use it in I’d 100% fail becuase of one of many auto_ptr’s pitfalls.
My question is: are there any real life tasks where auto_ptr is really usefull and does fit there well?
Clearly,
auto_ptrlooses againstunique_ptr.Now, in a ‘strict C++03 without boost’ world, I use
auto_ptrquite often, most notably :std::auto_ptrin the return type explicits that the object must be deletedrelease()only ifstd::map<>::insertreturns that insertion succeededconst std::auto_ptrto make it clear that the message will be destroyed no matter what.