Hi, Jerry Coffin!
On 19 Jul 97 09:25:36 you wrote to Sunir Shah
SS> int foo( void ) const;
JC> It's been quite a while. This is valid only for member functions and
JC> indicates that the member function isn't going to change the class of
JC> which it's a member.
I just did a peek into the draft, and noticed they introduced "mutable"
members. That is class members that can be changed in const functions like
the one above.
I once ran into that problem: I had a list class that could be accessed like
an array, with simple integral index and [] operator. It had a private member
that stored the last accessed index and its pointer, so traversing the list
in sequential, upward direction was fast as a real array. But that retrieval
operator could not be made const, as one could expect, and you could not pass
a constant (by value) list here and there because of that internal mechanism.
So that mutable proposal can really help. The only problem is that it's not
yet supported in compilers. Or did anyone see it implemented?
Paul
... Tired of stack overflow? Use the MIX language !!!
--- OS/2 Warp
---------------
* Origin: The FlintStones' Cave in BedRock (2:371/20)
|