Does a return type like this represent something meaningful in c++11?
template <typename R>
R&& grabStuff();
T instance = grabStuff<T>();
I would hope that grabStuff should throw a compile-time error if R does not have a move constructor, since this would seem to disallow the return type to use a copy constructor
As always, when returning references you must return a reference to something that’s still alive after the function returns. How you do that is up to you. Example:
The more typical example for returning an rvalue reference is
std::moveitself, though, which returns a reference to the thing you pass into it (and thus it’s the caller’s responsibility to provide a valid input).