From 3155508351329621847 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!news-in.ntli.net!newsrout1-win.ntli.net!ntli.net!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull From: nagle@animats.com (John Nagle) Newsgroups: comp.std.c++,comp.lang.c++ Subject: Re: The issue of const maps and operator[] Date: Sat, 4 Dec 2004 05:26:02 GMT Organization: SBC http://yahoo.sbc.com Lines: 66 Sender: mail2news@demon.net Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++) Message-ID: References: <3171vsF37jfq7U1@individual.net> <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 1102137972 16664 158.152.254.254 (4 Dec 2004 05:26:12 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Sat, 4 Dec 2004 05:26:12 +0000 (UTC) X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) X-User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, en, ja X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU X-UserInfo1: Q[R_PJONTRUARPLYZZODM^P@VZ\LPCXLLBWLOOAFMASJETAANVW[AKWZE\]^XQWIGNE_[EBL@^_\^JOCQ^RSNVLGTFTKHTXHHP[NB\_C@\SD@EP_[KCXX__AGDDEKGFNB\ZOKLRNCY_CGG[RHT_UN@C_BSY\G__IJIX_PLSA[CCFAULEY\FL\VLGANTQQ]FN 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 iB45Q2Yn028795; Sat, 4 Dec 2004 16:26:02 +1100 (EST) X-NNTP-Posting-Date: Fri, 03 Dec 2004 23:46:17 EST 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++:3571 comp.lang.c++:32677 If anything is done to "operator[]", it should be given the same syntax as "operator()", so we can have classes that support multiple subscripts. Inconsistently, foo(a,b) is a two-argument call, but foo[a,b] is an invocation of the comma operator followed by a one-argument call. One of the more obscure features of the language. John Nagle Animats Tom Widmer wrote: > On Fri, 3 Dec 2004 02:54:24 GMT, nesotto@cs.auc.dk ("Thorsten > Ottosen") wrote: > > >>"James Dennett" 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::at( const Key& ); >>const T& map::at( const Key& ) const; >> >>which should throw if nothing is found. > > > I like the symmetry with vector::at. > > >>Alternatively, I guess we could use operator()(). > > > I don't like that, since operator() hasn't been used like that > elsewhere and is usually used for functors. > > Tom > > --- > [ 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 ] > --- [ 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 ]