"Semi-const" methods?

Magnus Lie Hetland magnus at hetland.org
Sun Mar 13 15:32:34 PDT 2011


On 2011-03-13 23:27:14 +0100, Magnus Lie Hetland said:

> Any other ideas on how to handle this sort of "mostly const" or "const 
> where it counts" stuff? Perhaps my design intentions here are off to 
> begin with?-)

OK -- a *little* quick on the trigger there. My solution: Declare the 
method const, and assign the non-essential cache stuff to local 
variables, casting away the constness.

(Still open to schooling on the design part of this, though. Perhaps 
declaring a method as const is no good when it's not *really* const? 
For now, I'm just doing it to check that I don't inadvertently change 
things I don't want to change.)

-- 
Magnus Lie Hetland
http://hetland.org



More information about the Digitalmars-d-learn mailing list