Move Constructor - invalid type for defaulted constructor VS 2013

c++, c++11, visual-studio-2013

Solution

Because the VS2013 compiler doesn't support defaulted move constructors.

See the following note from MSDN:

Visual Studio does not support defaulted move constructors or move-assignment operators as the C++11 standard mandates. For more information, see the Defaulted and Deleted functions section of Support For C++11 Features (Modern C++).

Problem

I was reading regarding move constructor and I did this code in VS 2013... ``` class Student { unique_ptr<string> pName_; public: Student(string name) : pName_(new string(name)) { } ~Student() { } Student(Student&&) = default; // Here I get the error. void printStudentName(void) { cout << *pName_ << endl; } }; int main(void) { vector<Student> persons; Student p = Student("Nishith"); persons.push_back(std::move(p)); persons.front().printStudentName(); return 0; } ``` I get the "`Student::Student(Student&& )` : is not a special member function which can be defaulted" when I tried to compile it... Can anyone explain me why I am getting this error?

Original source