lundi 22 décembre 2014

C++ 11 - rvalue reference variables

What is the difference between



int a = 42;


and



int&& rvr = 42;


?


a is obviously an lvalue, but rvr is also an lvalue since it is a named variable, so can these expressions be considered exactly equivalent, and if not, in which scenarios the int&& declaration is preferred?


Aucun commentaire:

Enregistrer un commentaire