I could not wrap my mind around the following statement from Scott Meyer's Effective Modern C++...
it's especially important to bear in mind that a parameter is always an lvalue, even if its type is an rvalue reference. That is given
void f(Widget&& w);
the paramter w is an lvalue, event it s type is rvalue-reference-to-widget.
How come a parameter w is an lvalue, but its type is rvalue-reference-to-widget? When people say w is an lvalue, doesnt that mean that its type is a lvalue type? I am probably missing something.
EDIT: Mant thanks to those who commented...I am still a bit confusing. I guess I dont fully understand the definition of these concept involved. What are lvalue, rvalue, lvalue reference, rvalue reference? Are these part of the context free grammar of the c++ language? Do these have anything to with code generation? Can I think of type and value category two separate production rules in the c++ context free grammar? What do they mean?
Aucun commentaire:
Enregistrer un commentaire