This snippet is compiled without errors in Visual Studio 2013 (Version 12.0.31101.00 Update 4)
class A
{
public:
A(){}
A(A &&){}
};
int main(i
I encountered the same error, just because I had misused std::unique_ptr.
Note that std::unique_ptr is non-copyable, it is only moveable.
Here is the wrong demonstration.
class word;
class sentence
{
public:
sentence();
~sentence();
public:
// Wrong demonstration, because I pass the parameter by value/copying
// I should use 'std::shared_ptr< word >' instead.
sentence(std::initializer_list< std::unique_ptr< word > > sentence);
};
The following code is taken from MSVC compiler's STL library. We can see that the copy constructor and copy assignment operator of class unique_ptr are deleted explicitly.
unique_ptr(const unique_ptr&) = delete;
unique_ptr& operator=(const unique_ptr&) = delete;