3 ms·
You would only type 'mutable' at the handful places that really need to be mutable. You would also likely delete the 'const' that are already all over the place
by mjan22640 4y ago
You would only type 'mutable' at the handful places that really need to be mutable.
You would also likely delete the 'const' that are already all over the place.
If you really use mutation all over the place, then either you work on something unusual or you should learn to do better.
- jesse__ 4y ago> You would also likely delete the 'const' I never type `const` in the first place. I don't find it useful, which was the point of my original comment. > then either you work on something unusual In C++, I've been working on game engines, compilers, interpreters and occasionally some reverse engineering. Not sure if that counts as unusual. I'm always thinking about perf, so if I can safely modify something in-place, I usually do. > or you should learn to do better I do just fine without `const`, thank you. Maybe you should learn to have a more open mind.
- compiler-devel 4y agoconst can serve to mark invariants in your code as well as provide the compiler with information that it can use for optimizations. I highly recommend Scott Meyers' "Effective C++" wherein Item #3 is to 'Use const whenever possible'.
- deleted 4y ago[deleted]