Let's assume having:
template<typename T>
T&& f(T&& t) {
return std::forward<T>(t);
}
Presenter p;
auto x = f(std::move(p)); // x is new Presenter object - move ctor invoked
auto x = f(p); // x is new Presenter object - copy ctor invoked
auto& x = f(p); // x is lvalueRef, no copy / move ctor invoked
auto&& x = f(p); // x is lvalueRef, no copy /move ctor invoked
auto&& x = f(std::move(p)); // x is rvalueRef, no copy / move ctor invoked
and this is quite ok, hovever for that case:
auto& x = f(std::move(p)); // x is lvalueRef, no copy / move ctor invoked
Why we are able to assing to lvalueRef rvalueRef?
For instance we cant do:
auto& c = 1;
All help appreciated