I don't understand the following:
class Class {
public:
void operator=(string&&) {
cout << "here";
}
};
string func() {
return "Paul";
}
int main()
{
string&& rvalueref = func();
Class obj;
obj = rvalueref; <- error! Why isn't rvalueref a rvalue ref anymore?
return 0;
}
since I can bind a prvalue to a rvalue reference, I thought I could also pass it around. Why does the above fail?