mirror of
https://github.com/CnTransGroup/EffectiveModernCppChinese.git
synced 2025-01-14 06:10:32 +08:00
Update 5.RRefMovSemPerfForw/item28.md
Co-authored-by: Yi Yang <1948638989@qq.com>
This commit is contained in:
parent
5aed21b25d
commit
76cfccee0d
@ -9,7 +9,7 @@ template<typename T>
|
||||
void func(T&& param);
|
||||
```
|
||||
|
||||
被推导的模板形参`T`将根据被传给`param`的实参为左值还是右值而被编码.
|
||||
不管传给param的实参是左值还是右值,模板形参`T`都会编码。
|
||||
|
||||
编码机制是简单的。当左值实参被传入时,`T`被推导为左值引用。当右值被传入时,`T`被推导为非引用。(请注意不对称性:左值被编码为左值引用,右值被编码为**非引用**。)因此:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user