Re: Erase in a map



On Mar 19, 3:09 pm, "Igor Tandetnik" <itandet...@xxxxxxxx> wrote:
"freak" <farid.mehr...@xxxxxxxxx> wrote in message

news:1174297401.488107.309760@xxxxxxxxxxxxxxxxxxxxxxxxxxxx

On Mar 16, 9:35 pm, Charles Zhang <CharlesZh...@xxxxxxxxxxxxxxxxx>
wrote:
I want to erase items in a map based on some criteria.

use standard library:

std::remove_if
(connectionMap.begin(),connectionMap.end(),ConnExpired(current));

remove_if won't work on a map. It requires that elements of a container
be assignable, and map's elements aren't. Try it, it won't compile.
--
With best wishes,
Igor Tandetnik


I did and got nervous a bit.Looks like we have to write the code
manually.But I do not see any reason for assifnability.Maybe remove_if
needs to be changed to what we did here?

.



Relevant Pages

  • Re: Meyerss preference for vectors over maps
    ... >contiguity of vector elements in memory ensure ... I will a container of objects that are much ... >Reason is what I'm trying to understand better. ... >of vector vs. map very unclear. ...
    (comp.lang.cpp)
  • Meyerss preference for vectors over maps
    ... I will a container of objects that are much ... Reason is what I'm trying to understand better. ... of vector vs. map very unclear. ... is good for binary search in particular. ...
    (comp.lang.cpp)
  • Re: How to modify a Hashtable entry value in-place during enumeration?
    ... > foreach(DictionaryEntry e in map) ... > For some reason, the code below doesn't compile with some not very helpful ... > Please note that I am not trying to modify a key, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Ada.Containers.Indefinite_Ordered_Maps of gcc 4.0.1 has bug ?
    ... Empty_Map: constant Map; ... No_Element: constant Cursor; ... function Length (Container: Map) return Count_Type; ... pragma Inline; ...
    (comp.lang.ada)
  • Re: Base class referring to inheritor
    ... particular type implemented by the interface. ... the 'map' function is supposed to map a function ... That container is a Mappable: ... I would like to write a base class in the following way: ...
    (microsoft.public.dotnet.languages.csharp)

Loading