From -1226258389857173703
X-Google-Thread: f78e5,d50382f3e5ec6b4e
X-Google-Thread: 109fba,d50382f3e5ec6b4e
X-Google-Attributes: gidf78e5,gid109fba,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news1.google.com!news4.google.com!news.glorb.com!news2.euro.net!216.196.110.149.MISMATCH!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: jdennett@acm.org (James Dennett)
Newsgroups: comp.std.c++,comp.lang.c++
Subject: Re: The issue of const maps and operator[]
Date: Fri,  3 Dec 2004 16:19:55 GMT
Organization: Cox Communications
Lines: 43
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <iDSrd.193210$hj.38103@fed1read07>
References: <3171vsF37jfq7U1@individual.net> <YWxrd.191852$hj.44035@fed1read07> <41aef8cf$0$66398$14726298@news.sunsite.dk>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.demon.co.uk 1102090840 1402 158.152.254.254 (3 Dec 2004 16:20:40 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Fri, 3 Dec 2004 16:20:40 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7) Gecko/20040616
X-Accept-Language: en-us, en
X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU
X-Path: comp-std-cpp-robomod!not-for-mail
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id iB3GJuab009982;
	Sat, 4 Dec 2004 03:19:56 +1100 (EST)
X-NNTP-Posting-Date: Fri, 03 Dec 2004 00:14:54 EST
X-Delivered-To: std-c++@ucar.edu
X-Spamscanner: mailbox4.ucsd.edu  (v1.5 Aug 25 2004 09:28:35, 0.0/5.0 3.0.0)
X-Authentication-Warning: fed1read07.mgt.cox.net: news set sender to newsmaster@cox.net using -f
X-Newsgroups: comp.std.c++,comp.lang.c++
X-MailScanner: PASSED (v1.2.8 22083 iB35F17m033708 mailbox4.ucsd.edu)
Xref: g2news1.google.com comp.std.c++:3564 comp.lang.c++:32577

Thorsten Ottosen wrote:

> "James Dennett" <jdennett@acm.org> wrote in message 
> news:YWxrd.191852$hj.44035@fed1read07...
> 
> 
>>In spite of having found several discussions on this topic, I could not
>>find mention of whether this issue is going to be addressed when C++
>>gets its next major revision.
> 
> 
> |I find it enormously unlikely that this would be changed in the
> |next revision of C++.
> 
> yes true. but we are already looking into adding
> 
> T& map<K,T>::at( const Key& );
> const T& map<K,T>::at( const Key& ) const;

This is reasonable and somewhat consistent with the at
member in other standard library class templates.

> which should throw if nothing is found.
> Alternatively, I guess we could use operator()().

I wouldn't like that:
   mymap[1] = 3;
and
   mymap(1) = 3;
would then both be valid, with different semantics in
the case mymap.find(1) == mymap.end(); and identical
semantics otherwise, but they look too similar.  Let's
be consistent, and use "at" when we mean range-checked
access which throws if an element is absent.

-- James

---
[ 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://www.jamesd.demon.co.uk/csc/faq.html                       ]



