【发布时间】:2012-10-10 11:38:15
【问题描述】:
我刚刚看了 Scott Meyers Universal References in C++11,有一件事情我不太明白。
我对@987654322@ 作为“通用参考”(即auto&&)和常规auto 之间的区别有点困惑,它们什么时候不同?
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&&
【问题讨论】:
标签: c++ c++11 rvalue-reference type-deduction