isnt 5 a rvalue because it cannot be on the left side of the = sign because it does not have a memory location defined. |
The = sign is inconsequential, but you're right to pick on memory location: lvalue expressions identify objects that have memory locations, rvalue expressions identify objects that don't.
What you need to keep in mind, if you really want to understand this, is that lvalue and rvalue are categories of
expressions, while lvalue reference and rvalue reference are types of
variables.
5 is an expression whose value category is rvalue (since any non-string literal is rvalue).
refData is a variable whose type is lvalue reference (to const int). This has nothing to do with what 5 is. It's just the type you used in declaration.
Isnt it a rvalue reference.... |
An rvalue reference, as Disch correctly points out, is a variable with rvalue reference type, such as int&&.
Here's another helpful (hopefully) link:
http://en.cppreference.com/w/cpp/language/value_category