I have found many definitions/explanations for the terms Lvalue and Rvalue in C++, but they are quite abstract and it is not easy to apply them. One of the definitions I found (and which is more accessible) is the following one:
(both from tutorialspoint)
- An lvalue (locator value) represents an object that occupies some identifiable location in memory (i.e. has an address).
and
- An lvalue has an address that your program can access. Examples of lvalue expressions include variable names, including const variables, array elements, function calls that return an lvalue reference, bit-fields, unions, and class members.
My questions are:
- How can one recognize whether an object in C++ has an address?
- Is there an example of an object which looks like an Lvalue but is not an Lvalue?
- Is it possible to give a list of examples of Lvalues in C++ which is as complete as possible or which covers at least the most important examples of Lvalues?