Im still confuse at Rvalue and Lvalue

SO LValue is the one to be assigned

and RValue is the one containing it?

Is that right?
An lvalue means something that can go on the left hand side of the assignment operator, it could also go on the right hand side, but an rvalue can only go on the right hand side.
1
2
3
4
5
6
7
8
int a (0);
a = 1; //Valid as a is an lvalue

int b (0);
b = a; //Valid, lvalues can go on the right hand side

int c (1);
0 = 1; //Invalid, 0 is an rvalue, but is placed on the left hand side so won't compile. 
An lvalue is an expression that identifies a non-temporary object ...
...
A prvalue ("pure" rvalue) is an expression that identifies a temporary object (or a subobject thereof) or is a value not associated with any object.
http://en.cppreference.com/w/cpp/language/value_category


The original definition of lvalues and rvalues from the earliest days of C is as follows: An lvalue is an expression e that may appear on the left or on the right hand side of an assignment, whereas an rvalue is an expression that can only appear on the right hand side of an assignment.
...
However, C++ with its user-defined types has introduced some subtleties regarding modifiability and assignability that cause this definition to be incorrect. There is no need for us to go further into this. Here is an alternate definition which, although it can still be argued with, will put you in a position to tackle rvalue references: An lvalue is an expression that refers to a memory location and allows us to take the address of that memory location via the & operator. An rvalue is an expression that is not an lvalue.
Thomas Becker in http://thbecker.net/articles/rvalue_references/section_01.html#section_01
I see..

Thanks guys. I think I get it somehow.
Topic archived. No new replies allowed.