POV-Ray : Newsgroups : povray.off-topic : C++ question : Re: C++ question Server Time
28 Jul 2024 22:18:41 EDT (-0400)
  Re: C++ question  
From: Warp
Date: 3 Oct 2013 18:01:18
Message: <524de92e@news.povray.org>
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


Post a reply to this message

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