Re: Using 8.5.3p4 in C++11 Standard, how do I establish that T is
reference-compatible to a T&?
On 7/2/2013 3:22 PM, jaabelloc@yahoo.com wrote:
On Tuesday, July 2, 2013 3:43:15 PM UTC-3, jaab...@yahoo.com wrote:
Given
T w;
T& t = w;
how do I establish, using 8.5.3p4 and p5, that r binds to t below, i.e., that T is reference-compatible with T&?
T& r = t;
Observe that T is not the same type as T&, neither a base class of T&, and so according to 8.5.3p4 we can't say that T is reference-related to T&.
I'm looking specifically at the declaration T& r = t; which is
legal,
but I can't see how 8.5.3p4 could help me to assert that 'r' is
reference-related to 't'. I'm considering in this case: T1 = T and T2 =
T&. But T1 is not equal to T2, nor T1 is a base class of T2.
I honestly don't understand (yet) with what part of paragraph 4 of that
subclause you have a problem. It explains (establishes) the
relationship between two classes T1 and T2, and mentions reference
binding. In your case T is the same as T, and as such they are
reference-related. Read the next paragraph. A reference to type "cv1
T1" is initialized by an expression of type "cv2 T2"... In your case T1
is T and T2 is T. Substitute those and get: a *reference to type T* is
initialized by an *expression of type T*. So, the '&' is not part of
the 'cv1 T1' or 'cv2 T2', AFA reference initialization is concerned.
V
--
I do not respond to top-posted replies, please don't ask