Talk:More C++ Idioms/Move Constructor

I think that the wording "temporaries are const objects by default" is incorrect. If this was true, then it wouldn't be possible to do "this->resource_ = 0" in operator proxy, because code that modifies a constant object has undefined behavior.

The real reason for auto_ptr-style workaround is that function calls (temporary objects holding return values) are rvalues (C++98 standard, 5.2.2#10: "A function call is an lvalue if and only if the result type is a reference"), and rvalues can only be bound to const references (8.5.3#5).

The result is that one can implement move semantics by tricking this artificial limitation without using debatable techniques such as const_cast. The new C++09 standard will introduce rvalue references, which will make the workaround unnecessary.