From -107683162445158990
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,1e33266bee377e
X-Google-Attributes: gidf78e5,public
From: David R Tribble <david@tribble.com>
Subject: Re: mutable member data vs. mutable functions
Date: 2000/08/23
Message-ID: <39A421E2.7B349BFB@tribble.com>#1/1
X-Deja-AN: 661666626
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <39A14420.F81235AA@bellatlantic.net>
X-Accept-Language: en
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 967060286 mail2news:313 mail2news mail2news.demon.co.uk
Organization: The Vast Right-Wing Conspiracy
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
MIME-Version: 1.0
NNTP-Posting-Date: Wed, 23 Aug 2000 14:15:05 CDT
Newsgroups: comp.std.c++

Carl Nygard wrote:
> Is there any reason why the mutable concept wasn't extended to
> functions?  For example, given the example:
> [...]
> Is there some way for the Standard to be tweaked to allow the mutable
> keyword for functions, such that only functions marked mutable can
> change mutable members.  To external functions, mutable is the same as
> const, but internally, only mutable functions may change mutable
> members.

I'm not sure this is a good idea.  It would give us three kinds of
member functions:

a. Regular member functions (non-const, non-mutable) that (by virtue
  of not being declared const) are assumed to modify one or more
  data members.

b. Const member functions, that are assumed to not modify any
  non-mutable data members.

c. Mutable member functions, that are assumed to modify only mutable
  data members.

I can't see a big difference between (a) and (c).

--
David R. Tribble, mailto:david@tribble.com, http://david.tribble.com

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]




