How can a container be both contiguous and support move semantics at the same time?
An example with std::vector: When push_back() is called using std::move on an lvalue:
std::vector<MyClass> v;
MyClass obj;
MyClass obj2;
vt.push_back(std::move(obj));
vt.push_back(std::move(obj2));
obj and obj2 are not necessarily allocated next to each other in memory. Now as vector must have its elements in contiguous memory, how would move semantics work in this case? It seems to me that it must copy the obj2 to vector v's contiguous memory region (next to obj), otherwise the contiguosity requirement would not be satisfied. But that requires a copy, not a move. What is the difference between the above and this then?:
MyClass obj;
MyClass obj2;
vt.push_back(std::move(obj));
vt.push_back(obj2);