rvalue-reference

style in binding a reference to object-or-dummy

What is the best way to bind an rvalue reference to either a given object or a temporary copy of it? A &&var_or_dummy = modify? static_cast<A&&>( my_A ) : static_cast<A&&>( static_cast<A>( my_A ) ); (This code doesn't work on my recent GCC 4.6… I recall it working before, but now it always returns a copy.) On...

C++0x: conditional operator, xvalues, and decltype

I am reposting a comp.std.c++ Usenet discussion here because that group has become very unreliable. The last few posts I've submitted there have gone into the void, and activity has all but ceased. I doubt I've been banned and/or everyone else just lost interest. Hopefully all interested people will find this discussion, and there will b...

C++0x rvalue reference template argument deduction

Given GMan's deliciously evil auto_cast utility function concocted here, I've been trying to figure out why it doesn't compile for me when I'm trying to auto_cast from an rvalue (on MSVC 10.0). Here's the code that I'm using: template <typename T> class auto_cast_wrapper : boost::noncopyable { public: template <typename R> fr...