更新时间:2023-10-22 23:13:34
const&
表示,这个重载只会用于 const、non-const 和 lvalue 对象.
const&
means, that this overload will be used only for const, non-const and lvalue object.
const A a = A();
*a;
&
表示,这个重载将只用于非常量对象.
&
means, that this overload will be used only for non-const object.
A a;
*a;
&&
表示,这个重载将只用于右值对象.
&&
means, that this overload will be used only for rvalue object.
*A();
有关 C++11 标准的此功能的更多信息,您可以阅读这篇文章 什么是*this"的右值引用?
for more information about this feature of C++11 standard you can read this post What is "rvalue reference for *this"?