Skip to main content
Source Link
Frank Szczerba
  • 5k
  • 3
  • 33
  • 31

Your use with boost::mutex is exactly what this keyword is intended for. Another use is for internal result caching to speed access.

Basically, 'mutable' applies to any class attribute that does not affect the externally visible state of the object.

In the sample code in your question, mutable might be inappropriate if the value of done_ affects external state, it depends on what is in the ...; part.

Post Made Community Wiki by CommunityBot