Can you change state in a const function in C++? Why? How?
In this post, we discuss why you might want to change the state in a const function in C++, and how you can change the state using const_cast. We also discuss whether it is a good practice to use const_cast in C++ codebases.