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 4:36 PM, Belloc wrote:
On Tuesday, July 2, 2013 5:20:52 PM UTC-3, Victor Bazarov wrote:
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.
I dispute the fact that T2 is a T in the declaration "T& r = t;". For
me T2 is a T&. If the declaration was something like "T& r = w;" with
'w' being a T, then yes, T2 would be a T. Otherwise how would
differentiate the types between these these two declarations.
Oh, OK, I think I understand now. Sorry it took me so long. You are
talking about the right-hand side. The expression 't' (with which 'r'
is initialized) seems to contain the &, from your point of view. Well,
it does not. You need to turn to the chapter 5, expressions, paragraph
5 ([expr]/5).
V
--
I do not respond to top-posted replies, please don't ask