Domanda

According to C++ Standard 2003:

An lvalue (3.10) of a non-function, non-array type T can be converted to an rvalue.

What does it mean that array and function cannot be converted to rvalue?

È stato utile?

Soluzione

Both function and array types are covered by later clauses (4.2, 4.3).

An lvalue or rvalue of type “array of N T” or “array of unknown bound of T” can be converted to an rvalue of type “pointer to T.” The result is a pointer to the first element of the array.

(...)

An lvalue of function type T can be converted to an rvalue of type “pointer to T.” The result is a pointer to the function.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top