Why would a class/function have two overloads, one for lvalue and one for rvalue?
Eg, from this video, it says we have two overloads for vector<T>::push_back
void push_back( const T& value );
void push_back( T&& value );
Why can’t we have just one overload by value,
void push_back( T value );
If it was an lvalue, value would be copied and if it was an rvalue, value would be moved. Isn’t this the way how it works and guaranteed by the standard?
With your by-value proposition, technically there would be copy+move or move+move, whereas with the other two overloads there is a single copy or a single move.