Usage of std::swap() inside move assignment should cause endless recursion (and causes), but it is an example from Stroustrup's book
问题 I'm trying to get the deep knowledge about how should I write my copy and move constructors and assignment operators. In Bjarne Stroustrup's "The C++ Programming Language - 2013" I see the following example of move constructor and move assignment: template<class T, class A> vector_base<T,A>::vector_base(vector_base&& a) : alloc{a.alloc}, elem{a.elem}, space{a.space}, last{a.space} { a.elem = a.space = a.last = nullptr; // no longer owns any memory } template<class T, class A> vector_base<T,A>