Does std::remove_cvref
代替std::decay
C++20之后?
From 这个链接 https://github.com/thecppzoo/zoo/issues/7,
我无法理解这意味着什么:
C++20将有一个新特征std::remove_cvref
这不会产生不良影响std::decay
在数组上
有什么不良影响std::decay
?
请举例和解释!
std::remove_cvref
不取代std::decay
。它们用于两种不同的用途。
数组自然会衰减为指向其第一个元素的指针。std::decay
会将数组类型衰减为指针类型。所以,举例来说,std::decay<const char[N]>::type
is const char*
.
Whereas std::remove_cvref
删除const
, volatile
and &
来自类型而不更改该类型的任何其他内容。所以,举例来说,std::remove_cvref<const char[N]>::type
is char[N]
而不是char*
.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)