mutable、const、volatile关键字 C++中有三种修饰数据可变的关键字:mutable、const、volatile。 const const我们很常见,在定义一些不可变的常量或不修改数据内容的函数时经常会用到。 修饰变量,说明该变量不可以被改变; 修饰指针,分为指向常量的指针(例如constchar*,其自身可变,指向的是常量字符数组)和自身是常量的指针...
书名:C++新经典 作者名:王健伟编著 本章字数:169字 更新时间:2022-07-27 19:11:27 举报 上QQ阅读APP看后续精彩内容 下载QQ阅读APP,第一时间看更新 登录订阅本章 >
@Gregory –“The new additional meanings of const and mutable mean that most of the types have to be thread-safe. And I still do not get what thread-safe means here. And why const implies immutable in C++11. The immutability is not enforced in any way in the language. How can we be...