TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: JERRY COFFIN
from: BALOG PAL
date: 1997-07-21 23:55:00
subject: mutable

                              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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.