This question already has an answer here:
I was looking at the declaration of push_back in vector STL.
void push_back (const value_type& val);
void push_back (value_type&& val);
Questions :
- what is
&&in 2nd declaration? - In first declaration, we are passing by CONST reference val variable.
constmeans that we can't change theval, then why is it being passed as a reference if we don't want to change that. Why it's not declared as void push_back(value_type val)
Aucun commentaire:
Enregistrer un commentaire