0

While investigating the difference between lvalue reference and rvalue reference I found a useful page with strict definitions of what lvalue and rvalue are.

Now, assuming I know what lvalue and rvalue are, where can I find the definitions of lvalue reference and rvalue reference?

Is there some general definition of a reference that can be applied to both lvalue and rvalue? I other words is there some general term for & and &&?

Alexey Starinsky
  • 3,699
  • 3
  • 21
  • 57
  • 4
    A reference is an alias. A lvalue reference is a reference to a lvalue, a rvalue reference is a reference to a rvalue. – NathanOliver Jul 27 '22 at 18:02
  • 1
    Here you go [Reference initialization](https://en.cppreference.com/w/cpp/language/reference_initialization) – Richard Critten Jul 27 '22 at 18:04
  • _"is there some general term for & and &&?"_ Yes, the term is _reference_. – Drew Dormann Jul 27 '22 at 18:04
  • 1
    @AlexeyStarinsky Have you read the [`reference declaration` doc](https://en.cppreference.com/w/cpp/language/reference) that is on the same site you read the [`value categories` doc](https://en.cppreference.com/w/cpp/language/value_category) on? – Remy Lebeau Jul 27 '22 at 18:05
  • @DrewDormann good comment :), where is it defined? – Alexey Starinsky Jul 27 '22 at 18:07
  • 1
    @AlexeyStarinsky I think you're looking for [this](https://eel.is/c++draft/dcl.ref#1), if you're looking for something authoritative. – Drew Dormann Jul 27 '22 at 18:31

0 Answers0