fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct C
  5. {
  6. C(): a(0) {}
  7. mutable int a;
  8. };
  9.  
  10. int main() {
  11.  
  12. C c;
  13.  
  14. c.a = 10;
  15.  
  16. const C cc;
  17.  
  18. cc.a = 42; // без mutable эта строчка не компилируется
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3336KB
stdin
Standard input is empty
stdout
Standard output is empty