Fully transitive const is not necessary

Janice Caron caron800 at googlemail.com
Thu Apr 3 01:22:06 PDT 2008


On 02/04/2008, Steven Schveighoffer <schveiguy at yahoo.com> wrote:
> Absolutely, but I'd at least like Walter to stop saying that transitive
>  const (read, transitive *keyword* const) is neccessary for pure functions :)
>  If he says "Oh yeah, I guess transitive const isn't necessary, but it's not
>  a priority to fix it right now", then I'd be happy.

But hang on. It's all very well saying "pure functions can access the
non-mutable bits only", but in every case I can think of where I might
use the mutable keyword in C++, the non-mutable subset of the class is
completely useless without the mutable subset.

Can you give me a counterexample of a logically const (muty) class in
which the non-mutable subset is actually useful?



More information about the Digitalmars-d mailing list