POV-Ray : Newsgroups : povray.off-topic : C++ question : Re: C++ question Server Time
28 Jul 2024 22:29:16 EDT (-0400)
  Re: C++ question  
From: Anthony D  Baye
Date: 3 Oct 2013 20:20:00
Message: <web.524e08a91cbd09d0328783aa0@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.