Widget&& rhs 是左值还是右值引用

Is Widget&& rhs an lvalue or an rvalue reference

在有效的现代 C++ 中

class Widget {
public:
 Widget(Widget&& rhs); // rhs is an lvalue, though it has
 …                    // an rvalue reference type
};

rhs 是左值

void f(Widget&& param); // rvalue reference

param 是右值引用

rhs 和 param 有什么区别?

Type: 在这两种情况下,参数的类型都是 "rvalue reference to Widget".

值类别:参数的名称在这两种情况下都是左值表达式。

没有区别。

  • 进一步阅读: