|
|
Warp <war### [at] tagpovrayorg> wrote:
> Anthony D. Baye <Sha### [at] spamnomorehotmailcom> wrote:
> > all of this, combined, means that the getters for the spherical components
> > cannot take a const reference, so they can't be used from any function that has
> > a const qualifier, or used on a const reference.
>
> If you are using a kind of "temp values" as an optimization, and
> these values do not affect the external behavior of the class,
> you can declare those values as 'mutable', which allows modifying
> them even from a const method.
>
> (Well, nothing stops you from making them mutable even if they did
> affect the external behavior of the class. What I mean is that this
> should be done only when it does not, or else the class becomes badly
> designed.)
>
> --
> - Warp
I've never looked at the mutable keyword... Thanks for the tip.
Regards,
A.D.B.
Post a reply to this message
|
|