From 4323882091550391545
X-Google-Thread: f78e5,d50382f3e5ec6b4e,start
X-Google-Thread: 109fba,d50382f3e5ec6b4e,start
X-Google-Attributes: gidf78e5,gid109fba,public
X-Google-Language: ENGLISH,ASCII
Path: g2news1.google.com!news3.google.com!news.glorb.com!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull
From: zunino@inf.ufsc.br (=?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?=)
Newsgroups: comp.std.c++,comp.lang.c++
Subject: The issue of const maps and operator[]
Date: Thu,  2 Dec 2004 05:38:47 GMT
Organization: Universidade Federal de Santa Catarina
Lines: 32
Sender: mail2news@demon.net
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <3171vsF37jfq7U1@individual.net>
NNTP-Posting-Host: news.news.demon.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Trace: news.demon.co.uk 1101965942 15227 158.152.254.254 (2 Dec 2004 05:39:02 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Thu, 2 Dec 2004 05:39:02 +0000 (UTC)
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-User-Agent: Mozilla Thunderbird 0.9+ (Windows/20041127)
X-MIME-Autoconverted: from 8bit to quoted-printable by mulga.cs.mu.OZ.AU id iB25cxBn018548
X-Orig-X-Trace: individual.net XyxE8XUdMHoDIyNxTPO4BgRUAcrE1AKcmrYhaUjqMqnEEccxLA
X-Accept-Language: en-us, en
X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU
X-Received: (from fjh@localhost)
	by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id iB25clUA018318;
	Thu, 2 Dec 2004 16:38:47 +1100 (EST)
X-Path: comp-std-cpp-robomod!not-for-mail
X-Delivered-To: std-c++@ucar.edu
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Newsgroups: comp.std.c++,comp.lang.c++
Xref: g2news1.google.com comp.std.c++:3545 comp.lang.c++:32382

Hello.

Searching around before posting this message revealed that the issue has=20
been brought up a significant number of times (here are two related=20
threads [1] [2]). So /std::map<>/ does not provide a const version of=20
its /operator[]/ member function because that function is supposed to=20
modify the map in case the passed key is not present. The question which=20
follows is: why not provide a const overload which would throw when the=20
given key would not exist? It seems like a natural and easy-to-implement=20
solution which would contribute to map's associative array role.

In spite of having found several discussions on this topic, I could not=20
find mention of whether this issue is going to be addressed when C++=20
gets its next major revision. Could anyone provide some information=20
(comments, links, etc.) on this?

[1] http://groups.google.com/groups?hl=3Den&lr=3D&th=3D47b92be5c9ed558c&r=
num=3D1
[2] http://groups.google.com/groups?hl=3Den&lr=3D&th=3D698e93dddf8b22d0&r=
num=3D5

Thank you very much,

--=20
Ney Andr=E9 de Mello Zunino

---
[ 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                       ]



