I\'d like to have a vector of unique_ptr\'s as a member of a class I\'m making.
class Foo {
[...]
private:
vector> barList;
An excerpts from www.cplusplus.com
std::unique_ptr::operator=
unique_ptr assignment The object acquires the ownership of x's content, including both the stored pointer and the stored deleter (along with the responsibility of deleting the object at some point). Any object owned by the unique_ptr object before the call is deleted (as if unique_ptr's destructor was called).
But there is a warning too:
This page describes a feature introduced by the latest revision of the C++ standard (2011). Older compilers may not support it.
MSVC 2010 defines operator=
as private (non-copyable) but supports swap
method.