Apr 27, 2013

[C++11][NOTE]Lvalue-to-rvalue conversion

Lvalue-to-rvalue conversion

1A glvalue (3.10) of a non-function, non-array type T can be converted to a prvalue.53

If T is an incomplete type, a program that necessitates this conversion is ill-formed.

If the object to which the glvalue refers is not an object of type T and is not an object of

a type derived from T, or if the object is uninitialized, a program that necessitates

this conversion has undefined behavior. If T is a non-class type, the type of

the prvalue is the cv-unqualified version of T. Otherwise, the type of the prvalue is T.54

2When an lvalue-to-rvalue conversion occurs in an unevaluated operand or a

 subexpression thereof (Clause 5) the value contained in the referenced object is

not accessed. Otherwise, if the glvalue has a class type, the conversion copy-initializes

 a temporary of type T from the glvalue and the result of the conversion is a prvalue for

the temporary.

Otherwise, if the glvalue has (possibly cv-qualified) type std::nullptr_t,

the prvalue result is a null pointer constant (4.10).

Otherwise, the value contained in the object indicated by the glvalue is the prvalue result.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.