This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: map


On Thu, 01 Jan 1970 Alexandre Oliva wrote:
>Jochen Kuepper <jochen@uni-duesseldorf.de> writes:
>
>> I am missing the following function from the class map ( as of egcs-1.1 )
>
>>   const T& operator[](const key_type& k) const;
>
>> In the class header file (stl_map.h) there is only 
>
>>   T& operator[](const key_type& k);
>
>As the standard mandates.  The problem is that operator[] will insert
>a value for the given key_type if none exists.  I'm of the opinion
>that a const member function should have been defined, that would
>throw an exception if the key were not present in the map already, but
>the members of the standard committee thought otherwise :-(

So is this considered a bug of listdc++ as of egcs-1.1 ?
Is it fixed in the current version ?

As I see it is save to use the non-const function on const objects in the
current implementation - is that right ?

Btw: Will there be something like egcs-1.1.[12] ?

Greetings,
Jochen
-----------------------------------------------------------------------
  Jochen K"upper

  Heinrich-Heine-Universit"at D"usseldorf   jochen@uni-duesseldorf.de
  Institut f"ur Physikalische Chemie I
  Universit"atsstr. 1, Geb 26.43 Raum 02.29    phone ++49-211-8113681
  40225 D"usseldorf                            fax   ++49-211-8115195
  Germany             http://www-public.rz.uni-duesseldorf.de/~jochen
-----------------------------------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]