Boost logo

Boost :

Subject: Re: [boost] Boost and auto_ptr (was Boost 1.60.0 beta 1...)
From: Artyom Beilis (artyomtnk_at_[hidden])
Date: 2015-11-10 07:51:52


>On 2015-11-09 18:52, Marshall Clow wrote:
>

>[snip]
>I'm seeing lots of warnings about use of deprecated std::auto_ptr in >different libraries: Boost.DateTime, Boost.Locale, Boost.Signals. I've
>attached the list of places where these warnings occur.
>[snip]
>

See... unlike Boost, most of the ordinary world still uses C++2003 and will use
it for a long time especially for existing projects.

Existing libraries like Boost.Locale support C++2003.

std::auto_ptr is perfect way to provide ownership move semantics
without rvalue reference despite the fact some may abuse it.

So when you do need have to have move semantics, auto_ptr needs to be
there.

Using

#ifdef USING_CPP11
std::unique_ptr<foo> bar();
#else
std::auto_ptr<foo> bar();
#endif

Both makes horrible code and adds huge binary compatibility issues that Boost has enough of them.

IMHO deprecation of std::auto_ptr was one of the biggest design mistakes of C++11 because
it does not allow writing code that supports both C++03 and C++11.

std::auto_ptr isn't broken the way gets is, it is actually very good class with its limitations.
So Boost.Locale would keep using auto_ptr until another "smart guy" in C++1X/2X committee
would decide to break more good things and remove it entirely so there would be no choice.

Artyom Beilis


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk