Boost logo

Boost :

Subject: Re: [boost] std::auto_ptr in public interfaces
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2017-05-20 16:16:13


On 05/20/17 18:45, Daniela Engert via Boost wrote:
> Am 20.05.2017 um 17:28 schrieb Andrey Semashev via Boost:
>> ...
>> Personally, I would prefer libraries to switch to boost::unique_ptr and
>> leave std::auto_ptr interfaces available (but deprecated) for backward
>> compatibility.
>
> But, if you break the interface and people's code by replacing
> std::auto_ptr by boost::unique_ptr

I'm not suggesting to break code, at least not until absolutely needed.
All APIs that contain std::auto_ptr would likely have to be duplicated
with boost::unique_ptr equivalents.

> (is there such a thing in the first
> place, I couldn't find one in Boost.Smart_ptr?),

It's part of Boost.Move.

https://github.com/boostorg/move/blob/develop/include/boost/move/unique_ptr.hpp

Right, I forgot it's boost::movelib::unique_ptr, not boost::unique_ptr.
Ideally, it should be moved to Boost.SmartPtr as that's the more
appropriate library for such a component, IMO.

> why not just going
> straight to std::unique_ptr?

Because you would lose compatibility with C++03, which I presume the
authors of the libraries want to keep. Also, the API and ABI would be
C++ version agnostic this way.


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