The efficient way to write move copy and move assignment constructors
问题 Are the following assignment and copy move constructors the most efficient? if anybody have other way please tell me? I mean what bout std::swap? and calling assignment through copy constructor is safe in the code below? #include <iostream> #include <functional> #include <algorithm> #include <utility> using std::cout; using std::cin; using std::endl; using std::bind; class Widget { public: Widget(int length) :length_(length), data_(new int[length]) { cout<<__FUNCTION__<<"("<<length<<")"<<endl