AJG*_*G85 95
该const限定符所适用类型眼前的左侧,除非有什么向左然后将其应用于类型眼前的权利.所以是的,它是一样的.
And*_*Dog 21
举例:
std::vector<char*> test;
const auto a = test[0];
*a = 'c';
a = 0; // does not compile
auto const b = test[1];
*b = 'c';
b = 0; // does not compile
Run Code Online (Sandbox Code Playgroud)
无论a和b有型char* const.不要以为你可以简单地"插入"类型而不是关键字auto(这里:) const char* a!该const关键字将应用于auto匹配的整个类型(此处为:) char*.
| 归档时间: |
|
| 查看次数: |
12093 次 |
| 最近记录: |