Topic: Mutable
Author: sorry@but.spammed.out (Howard Hinnant)
Date: 1997/12/16 Raw View
In article
<Pine.SOL.3.95q.971213225240.2846A-100000@somerville.math.uwaterloo.ca>,
Sunil Puri <spuri@undergrad.math.uwaterloo.ca> wrote:
> What is the mutable keyword used for?
A data member of a class that is declared mutable can be modified even for
a const instance of the class (during a const member method).
This is helpful for a class that holds data such as a cache. A const
method may update the cache, even though there is no logical or conceptual
change to the object. Thus the cache should be mutable.
-Howard
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: "Stephen A. Ecker" <secker@wausaufs.com>
Date: 1997/12/16 Raw View
It specifies that an instance variable can be modified when the object is
const, such as from within a const member function.
Stephen A. Ecker
secker@coredcs.com
Sunil Puri wrote in message ...
>What is the mutable keyword used for?
>
>Sunil Puri
>spuri@undergrad.math.uwaterloo.ca
>---
>[ comp.std.c++ is moderated. To submit articles: Try just posting with
your
> newsreader. If that fails, use
mailto:std-c++@ncar.ucar.edu
> comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
> Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
> Comments? mailto:std-c++-request@ncar.ucar.edu
>]
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Author: Sunil Puri <spuri@undergrad.math.uwaterloo.ca>
Date: 1997/12/15 Raw View
What is the mutable keyword used for?
Sunil Puri
spuri@undergrad.math.uwaterloo.ca
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]