3 ms·
> std::move is just std::copy with a compiler-defined constructor invocation potentially run to determine the old value I have no idea what that means. std::m
by gpderetta 2y ago
> std::move is just std::copy with a compiler-defined constructor invocation potentially run to determine the old value
I have no idea what that means.
std::move is a cast to an rvalue reference. That can potentially trigger a specific overloaded function to be selected and possibly, ultimately, a move constructor or assignment operator to be called.
For an explicit move to be profitable, an expression would have otherwise chosen a copy constructor for a type with an expensive copy constructor and a cheap move constructor.
std::copy is a range algorithm, not sure what's the relevance.
- jvanderbot 2y agoYes, typed too fast. I meant the explicit copy constructor. Luckly, HN will hide my garbage text quickly enough. Thanks for the correction!