If you read code like
auto&& var = foo();
where foo
is any function returning by value of type T
. Then var
is an lvalue of type rvalue reference to T
. But what does this imply for var
? Does it mean, we are allowed to steal the resources of var
? Are there any reasonable situations when you should use auto&&
to tell the reader of your code something like you do when you return a unique_ptr<>
to tell that you have exclusive ownership? And what about for example T&&
when T
is of class type?
I just want to understand, if there are any other use cases of auto&&
than those in template programming; like the ones discussed in the examples in this article Universal References by Scott Meyers.