3 ms·
It's definitely an appropriate use of std::move. When the local object destructs std::move has already ripped its guts out and put them in the object up the sta
by a8da6b0c91d 11y ago
It's definitely an appropriate use of std::move. When the local object destructs std::move has already ripped its guts out and put them in the object up the stack. The local object is just an empty shell at destruction.
- nly 11y agoIt's a safe, but inappropriate, use of std::move, which is kind of the point of the article ;)
- seabee 11y agoThe 'object up the stack' is an rvalue reference. While we've successfully returned a reference into the caller's stack frame (RVO), the object it referred to has already been destroyed. That's why you see 'constructor, destructor' before 'move constructor'. I'm struggling to see how it's an appropriate use of std::move in any case where you actually use the rvalue reference!