[Kde-games-devel] Unify pixmap caching across card games

Dmitry Suzdalev dimsuzkde at gmail.com
Sun Jan 6 22:31:00 CET 2008


On Sunday 06 January 2008 19:01:03 Burkhard Lehner wrote:
> You could use the right amount of "mutable" modifiers to have both, a const
> get method, and the possibility to modify member variables.
> This is exactly the situation the modifier "mutable" was created for, so
> why not use it?
Yup. The "cache" usecase is most common example used to demonstrate "mutable" 
keyword in most C++ books. When some method *should look like* it's const to 
the class user, make it const and declare data field(s) as "mutable".

Cheers,
Dmitry.



More information about the kde-games-devel mailing list