Why was the definition of a variable changed during the development of C++11?
n3035 says:
A variable is introduced by the declara开发者_开发知识库tion of an object. The variable's name denotes the object.
n3090 says:
A variable is introduced by the declaration of a reference other than a non-static data member or of an object. The variable's name denotes the reference or object.
I wonder what motivated this change. Does it have to do with rvalue references?
The change was in response to CWG defect 633. The list of changes related to this can be found in n2993:
The goal of these changes is to expand the meaning of "variable" to encompass both named objects and references, and to apply the term consistently wherever feasible.
精彩评论