0

I'm interested in why rvalue references are called exactly "rvalue references". How does it relate to rvalue, prvalue etc concepts. The section N3797::5/5 says:

If an expression initially has the type “reference to T” (8.3.2, 8.5.3), the type is adjusted to T prior to any further analysis. The expression designates the object or function denoted by the reference, and the expression is an lvalue or an xvalue, depending on the expression.

That's an expression in which rvalue reference involves is adjusted to an lvalue or an xvalue, but not to rvalue or prvalue.

  • 2
    It is because the reference *must* be bound to an rvalue. An lvalue reference may be bound to lvalues or rvalues. – M.M Oct 02 '14 at 04:37
  • @MattMcNabb But what about lvalue-to-rvalue standard convertion? Why isn't it performed? –  Oct 02 '14 at 04:40
  • That is performed during expression evaluation . I don't see what that has to do the question "why are rvalue references called rvalue references". Your quote talks about how rvalue references are evaluated in an expression. The name "rvalue reference" applies to how the reference is bound, not to what it does in an expression. – M.M Oct 02 '14 at 04:53
  • An xvalue is a type of rvalue. – Brian Bi Oct 02 '14 at 04:54
  • @DmitryFucintv, can you post some code to explain your questions a bit better? – R Sahu Oct 02 '14 at 04:54
  • @RSahu There is no any code. I'm just trying to understand these concepts formally. –  Oct 02 '14 at 04:55
  • 1
    The initialization of references are specified in §8.5.3 [dcl.init.ref]/p5. It explicitly prohibits initializing an rvalue reference from an lvalue expression if the reference's type is reference-related to the expression's type. – T.C. Oct 05 '14 at 09:51

0 Answers0