给定 c++ 关键字 decltype 并用代码示例进行说明:
int main(){
int variableName = 0;
sizeof(variableName) == sizeof(decltype(variableName));//Always true for all types? And for all expressions?
//
//
double variableDoubleName = 0;
sizeof(variableName+variableDoubleName) == sizeof(decltype(variableName+variableDoubleName));//further example of an expression.
}
Run Code Online (Sandbox Code Playgroud)
在上面的例子中,一般来说, sizeof(non-type) 和 sizeof(decltype(non-type)) 总是严格相等的吗?如果不是,它们会有什么不同?
| 归档时间: |
|
| 查看次数: |
154 次 |
| 最近记录: |