[英]Removing CV qualifiers when deducing types using declytype
I have a constant declared as following: 我有一个常量声明如下:
const auto val = someFun();
Now I want another variable with same type of 'val' but without the constant specification. 现在,我想要另一个具有相同类型“ val”但没有常量说明的变量。
decltype(val) nonConstVal = someOtherFun();
// Modify nonConstVal, this is error when using decltype
Currently decltype keeps the constness. 当前,decltype保持常数。 How to strip it? 如何剥离?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.