If I construct an object at location A (with placement new) and attempt to move that object to location B with std::move(), will I have to call the destructor of the object at location A? Or will the compiler do that for me?
Do you /need/ to call the destructor though? If the resources of the object have already been moved elsewhere (and are now owned elsewhere), there shouldn't be anything that needs to be cleaned up, if my understanding is correct.
Edit: maybe I can see some situations where you would still need the destructor. I think you would have to call it explicitly.
@Peter87 & Cubbi:
It's hardly moving then is it? It turns out that std::move() just prepares its argument for moving whilst avoiding the copy-constructor; it's the move-constructor that does the moving - kinda misleading, really.
Any road, at least I know for the future.
Oh, and for anyone who reads this in the future: GCC supports implicit move-constructors, while Microsoft's Visual C++ does not; not even in Visual C++ 2011, apparently.
std::move() just prepares its argument for moving whilst avoiding the copy-constructor; it's the move-constructor that does the moving - kinda misleading, really.
Not necessarily constructor, it works the same way with assignment, push_back(), or any other function that has lvalue- and rvalue-taking overloads. And yes, std::move is a bit misleading, I'd call it std::xvalue