3 ms·
const 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 Mey
by compiler-devel 4y ago
const 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'.