Boost logo

Boost :

Subject: Re: [boost] [move] unique_ptr: problems with move-assign constructor when used with base/derived classes in C++03
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2015-03-06 11:46:12

El 05/03/2015 a las 12:17, Adam Romanek escribió:
> Hi,
> There is a problem with move-assignment constructor in
> boost::movelib::unique_ptr when used with a pair of base/derived classes
> in C++98/03 mode [1] (uncomment the code to see the compiler error).
> Is it a known issue? Or a limitation of the emulation?

It's a limitation because the c++03 standard requires a viable copy
constructor for copy initialization expressions:

T t = T()

and unique_ptr has no copy constructor.

Some non-conforming compilers (like MSVC 7.1) don't require it, but the
standard is clear. You can use use direct initialization to get the same

unique_ptr<Base> z(boost::move(x));



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