This document appears to be the source of these changes from C++11: n3055.
lvalues meaning was not changed, but glvalues were introduced to cover xvalues.
Why not do the same for rvalues?!
rvalues meaning should have remain unchanged, but introduce grvalues to cover xvalues too. (prvalues could be replaced back to simple rvalues in symmetry with how lvalues are defined)
expression
/ \
glvalue grvalue
/ \ / \
lvalue xvalue rvalue
Value categories can be defined more simple:
- an lvalue has identity but cannot be moved from; is a glvalue that is not an xvalue
- an rvalue has no identity but can be moved from; is a grvalue that is not an xvalue
- an xvalue has identity and can be moved from.
Every expression is either an lvalue, xvalue or rvalue.
Aucun commentaire:
Enregistrer un commentaire