From -5775129682496899179
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,c0e61b6a667823c0
X-Google-Attributes: gidf78e5,public
From: sbnaran@localhost.localdomain (Siemel Naran)
Subject: Re: no const operator[] in STL map?
Date: 1999/01/24
Message-ID: <slrn7amjhq.7vm.sbnaran@localhost.localdomain>#1/1
X-Deja-AN: 436350524
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <916993358.766341@aloomba.aaii.oz.au> <slrn7ai4q5.9dj.sbnaran@fermi.ceg.uiuc.edu> <36AA5AA6.2CC30DA4@ibm.net>
X-Original-Date: 24 Jan 1999 16:46:39 GMT
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: izvestia.its.unimelb.edu.au 917196851 21102 128.250.29.16 (24 Jan 1999 16:54:11 GMT)
Organization: University of Illinois at Urbana-Champaign
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUANqtQH+EDnX0m9pzZAQE24AF+P58EkWLeV9vKTLlL9fmn1CEuFp77f27S sl69E46RDSd1E4blLBOwfUI6MICzmwqC =Mr4B
Reply-To: sbnaran@uiuc.edu
NNTP-Posting-Date: 24 Jan 1999 16:54:11 GMT
Newsgroups: comp.std.c++

On 24 Jan 99 14:01:23 GMT, Biju Thomas <bijuthom@ibm.net> wrote:

>Does it mean that the mapped_type stored in a map should always have a
>default constructor? If I don't have a default constructor for the
>mapped_type, is there any way for me to specify the value from which the
>mapped_type object can be copy-constructed. (For example, like in the
>constructor for vector.)

If you use operator[], then yes, a default constructor is required.
If you use insert(const T&), then a default constructor is not required.

-- 
----------------------------------
Siemel B. Naran (sbnaran@uiuc.edu)
----------------------------------
---
[ 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              ]



