3 ms·
Should have be called give(). But naming things correctly is hard, and the C++ committee is known to do a lot of things incorrectly
by rurban 10mo ago
Should have be called give(). But naming things correctly is hard, and the C++ committee is known to do a lot of things incorrectly
- masklinn 10mo agoThat has about the same issue: like std::move it doesn't really explain that the receiver decides.
- vouwfietsman 10mo agostd::offer
- repelsteeltje 10mo ago∆ That's actually quite accurate. I like it!
- spot5010 10mo agoMaybe a std::take to pair with it?
- HarHarVeryFunny 10mo agostd::abandon() ?!
- pseidemann 10mo agoThere is no giving (or taking). I think std::rvalue would be the least confusing name.
- usrnm 10mo agoThe name predates the standardisation. The committee did not come with the whole thing themselves, rather they adopted and expanded already existing library implementations. You could move in C++, with this exact name, long before C++11. See, for example, this implementation https://stlab.adobe.com/group__move__related.html https://stlab.adobe.com/group__move__related.html
- tialaramex 10mo agoHoward Hinnant's original move proposal for C++ is from 2002. And by then even the destructive move (the more useful operation and the semantic provided in Rust) was well understood. Hinnant said they couldn't find a way to do destructive move and have the C++ inheritance hierarchy. To me it's obvious what loses in this case, but to a C++ programmer at the turn of the century apparently C++ implementation inheritance ("OO programming") was seen as crucial so C++ 11 move semantics are basically what's described in that proposal.
- jsphweid 10mo agostd::movable