type deduction
,auto&&
以及指定类型的&&
和模板参数T&&
。讲解了什么情况下&&
是universal reference, rvlue reference。(??)对于写程序来说,以下左右值定义足够:
- If you can take the address of an expression, the expression is an lvalue.
- If the type of an expression is an lvalue reference (e.g., T& or const T&, etc.), that expression is an lvalue.
- Otherwise, the expression is an rvalue. Conceptually (and typically also in fact), rvalues correspond to temporary objects, such as those returned from functions or created through implicit type conversions. Most literal values (e.g., 10 and 5.3) are also rvalues.
Universal References in C++11(&&)
原文:https://www.cnblogs.com/codemeta-2020/p/12517408.html