Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • @vsoftco, yeah sure. It is a good point to use mutable members when you want to cache some calculations that is done in const methods in order to get a better response time. Commented Apr 12, 2015 at 1:08
  • Actually I take it back, you cannot call non-const member functions from inside const methods, no matter what. I misread the question, upvoted your answer. Commented Apr 12, 2015 at 1:20
  • You can actually const_cast<Foo*>(this) and call a const method, but it only works ok on non-const objects. On const objects it leads to undefined behaviour. Commented Apr 12, 2015 at 2:04