rvalues and temporary objects in the FCD

与世无争的帅哥 提交于 2019-11-29 11:03:52

Yes, i agree with you. This should be fixed in my opinion, and several people i deeply pay respect to have risen the exact same question about this.

Amir Ahmed Ansari

This isn't as complicated as it sounds. I am referring to the now finalized standard ISO/IEC 14882-2011. Page 78 says:

An xvalue (an “eXpiring” value) also refers to an object, usually near the end of its lifetime (so that its resources may be moved, for example). An xvalue is the result of certain kinds of expressions involving rvalue references (8.3.2).

The bold above has been added by me. The standard further says:

An rvalue (so called, historically, because rvalues could appear on the right-hand side of an assignment expression) is an xvalue, a temporary object (12.2) or subobject thereof, or a value that is not associated with an object.

So you only get an xvalue when you are playing around with 'certain kinds of expressions involving rvalue references'. Otherwise your temporary objects are just that - temporary objects.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!