Compile error when using remove_if on a map

Levente Farkas !spam-lfarkas@mindmaker.hu
Tue May 23 02:09:00 GMT 2000


"Eduardo T. Solis" wrote:
> 
> I'm tried the two suggestions below but it still gives me the same compile
> time error.
> 
> I think the problem boils down to as follows...
> 
> Given
> 
>    pair<const int, int> a;
>    pair<const int, int> b;
> 
> you can't do the following..
> 
>   a = b;
> 
> because a.first is a const.  I believe that the template code for the
> remove_if algorithm somehow does this when applied to a map.

ohh, yes of course remove_if just rearrange the elementns in the container
(move the element to be deleted to the end of the sequance) which is not 
usable with map:-)

ps. sorry for my first reply I was too lasy to think about it just
notice the first problem;-)

 -- lfarkas
 "The only thing worse than not knowing the truth is
  ruining the bliss of ignorance."


More information about the Libstdc++ mailing list