mutable

  mutable只能用于修饰类的非静态数据成员。对于使用使用mutable修饰的成员变量,const成员函数能够调用它,并改变它的值。若是缺乏mutable,那么就没法编译经过。html   mutable具备欺骗性,使用它可使const的成员函数悄悄的改变的类的成员函数,而无须使用const_cast来转换this指针。函数 class X{  public:    void foo() co
相关文章
相关标签/搜索