News for hackers. Stuff that matters.
Re:Move in C++ without a std:move by bluGill on Wednesday September 02, 2026 @09:13AM (#49535703)
std::move is a great tool when used correctly. However used incorrectly it makes code worse: more verbose and less performant. Since I have no idea how you are using it I can't comment on your experience. My experience is people (including me!) get it wrong fairly often. Fortunately tools can detect a lot of cases where you get it wrong.
Re:Move in C++ without a std:move by sprocketz on Wednesday September 02, 2026 @10:51AM (#49537214)
My little trick is to think of them as "oh, I accidentally made an lvalue from an actual rvalue here because a name was introduced, so I need to cast (i.e move() or forward()) back to an rvalue again", that's why i have them as macros: MOVE_CAST and FORWARD_CAST defined as static_cast (also avoids blowing up compile times). I never think in terms of "moving this object".