After reading the post:http://www.cprogramming.com/c++11/rvalue-references-and-move-semantics-in-c++11.html.
I can not figure out that when you write functions that take lvalue or rvalue references as arguments, such as this:
void printReference (const string& str)
{
cout << str;
}
void printReference (string&& str)
{
cout << str;
}
why the first printReference function could accept any argument, whether it be an lvalue or an rvalue, and regardless of whether the lvalue or rvalue is mutable or not. However, in the second printReference function, just allow to pass mutable rvalue.
May be my understanding is wrong, could anyone help me figure out it.