void test_rr(std::string const &lvalue)
{
std::cout<<"this is lvalue"<<std::endl;
}
void test_rr(std::string &&lvalue)
{
std::cout<<"this is rvalue"<<std::endl;
}
int main()
{
test_rr("this is"); //will output "this is lvalue"
std::cout<<"system pause"<<std::endl;
std::cin.get();
return 0;
}
how could I treat "this is" as rvalue reference?
The easiest way I could think is
std::string temp = "this is"
test_rr(std::move(temp));
compiler = msvc2010
os = win7 64bits