I just watched Scott Meyers Universal References in C++11 and there was one thing I could not quite understand.
I am a bit confused as to what the difference is between a auto
as a "universal reference", i.e. auto&&
and a regular auto
, when do they differ?
Foo f;
Foo& lvr = f;
auto lvr_a = f; // Foo&
auto rvr_a = std::move(f); // Foo&& or is it Foo?
auto&& lvr_b = f; // Foo& && => Foo&
auto&& lvr_b = std::move(f); // Foo&& && => Foo&&