Reference (C++) - ISO Definition

ISO Definition

References are defined by the ISO C++ standard as follows (excluding the example section):

In a declaration T D where D has the form & D1

and the type of the identifier in the declaration T D1 is “derived-declarator-type-list T,” then the type of the identifier of D is “derived-declarator-type-list reference to T.” Cv-qualified references are ill-formed except when the cv-qualifiers (const and volatile) are introduced through the use of a typedef (7.1.3) or of a template type argument (14.3), in which case the cv-qualifiers are ignored. [Example: in

typedef int& A; const A aref = 3; // ill-formed; // non-const reference initialized with rvalue

the type of aref is “reference to int”, not “const reference to int”. ] A declarator that specifies the type “reference to cv void” is ill-formed.

It is unspecified whether or not a reference requires storage (3.7).

There shall be no references to references, no arrays of references, and no pointers to references. The declaration of a reference shall contain an initializer (8.5.3) except when the declaration contains an explicit extern specifier (7.1.1), is a class member (9.2) declaration within a class declaration, or is the declaration of a parameter or a return type (8.3.5); see 3.1. A reference shall be initialized to refer to a valid object or function. —ISO/IEC 14882:1998(E), the ISO C++ standard, in section 8.3.2

Read more about this topic:  Reference (C++)

Famous quotes containing the word definition:

    Scientific method is the way to truth, but it affords, even in
    principle, no unique definition of truth. Any so-called pragmatic
    definition of truth is doomed to failure equally.
    Willard Van Orman Quine (b. 1908)