Boost logo

Boost :

Subject: Re: [boost] unique_ptr for C++03
From: Andrew Ho (helloworld922_at_[hidden])
Date: 2013-08-05 02:12:32

> Oops, I removed the delegated constructor calls and used a call to a
> function which may not exist if the type is not convertible. However, the
> compiler error message this generates is less intuitive than usually
> is saying something for template compiler messages :P).

update: I switched to a default function parameter to an internal nat
struct, this should make the compiler message easier to understand without
forcing/allowing users to do something "non-standard".

In my tests, I have come up to a problem:

std::unique_ptr allows the user to "move-construct" from a std::auto_ptr.
However, this class is not marked as to be movable with move emulation.

There are two solutions I could think of:

1. Remove the constructor if there's no true rvalue refs.
2. "Move-construct" from a std::auto_ptr&.

1 disallows some behavior which is standard, and 2 allows more behavior than
the standard allows. Which should we go with, or does anyone know of a
better work-around?

My personal vote is for 1 as the user could just as easily do:

// still valid standard c++11

With 2 there is no way to stop the user from doing something non-standard

// standard c++11 requires std::move(my_aptr)

I think this issue and support for std::nullptr_t are the only two remaining
pieces which would allow this class to be used in a non-standard compliant

Boost list run by bdawes at, gregod at, cpdaniel at, john at