BP> I once ran into that problem: I had a list class that could be acces
BP> an array, with simple integral index and [] operator. It had a priva
BP> that stored the last accessed index and its pointer, so traversing t
BP> in sequential, upward direction was fast as a real array. But that r
BP> operator could not be made const, as one could expect, and you could
BP> a constant (by value) list here and there because of that internal m
I don't think that this is very good design. I'd rather use an
iterator to store the current state of an iteration.
BP> So that mutable proposal can really help. The only problem is that i
Yes. It's useful in cases where the values of an object's attributes
are modified but not the object's state as perceived by its clients.
An example is objects performing lazy evaluation. Toward its clients,
an object changes its state when the state of another object changes
of which its state depends. The object's implementation may defer the
state update to the moment when the state is retrieved by a client.
BP> yet supported in compilers. Or did anyone see it implemented?
Borland C++ supports it.
Thomas
---
þ MM 1.0 #0113 þ Einsamkeit geniesst man am besten zu zweit
---------------
* Origin: McMeier & Son BBS (2:301/138)
|