on Mon Aug 29 2011, Christopher Jefferson
On 29 Aug 2011, at 14:04, Szymon Gatner wrote:
2011/8/27 Dave Abrahams
: No, it's the easiest way to get move assignment semantically correct, but not "the preferred way." At least, it's not universally preferred. See http://cpp-next.com/archive/2009/09/your-next-assignment/>>
Thanks, great read! I am still trying to fully understand all implications of move semantics. For example: is std/boost::move() killer of potential RVO?
I mean:
std::vector<int> getNumbers() { std::vector<int> ret;
// fill data
return move(ret) // will that kill potential (N)RVO? }
std::move does not hurt RVO in compilers I have tried it in. boost::move, when emulating move semantics in C++03, does seem to confuse RVO in some situations (sorry if that is a bit vague, I did not do a full and complete investigation).
Also note: C++11 inserts the move there implicitly, so you never need to write "return move(...)" -- Dave Abrahams BoostPro Computing http://www.boostpro.com