Compile error when using remove_if on a map
Eduardo T. Solis
esolis@ntsp.nec.co.jp
Tue May 23 02:01:00 GMT 2000
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.
Ed
Levente Farkas wrote:
>
> you have to define foo as:
> --------------
> class foo
> {
> public:
> bool operator()(const pair<const int,int>& item);
> };
> --------------
> but the best would be
> --------------
> class foo
> {
> public:
> bool operator()(const map<int,int>::value_type& item);
> };
> --------------
>
More information about the Libstdc++
mailing list