KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
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?
Tags (comma-separated)
Save Edits
Cancel