Re: remove_if under visual c++.net 2005
fifth8118 wrote:
"...... error C3861: remove_if: cannot find identifier" [..]
///////////////////////////////////////////////////////////////
#include "stdafx.h" //Deleted under Linux
#include <vector>
#include <iostream>
struct A {
int value;
int flag;
friend class IsFlag;
}a;
class IsFlag {
public:
bool operator() (const A &rhs) {
return (rhs.flag ==1)?true:false;
}
};
int main () {
int i;
std::vector <A> N;
for (i=0; i<10; i++) {
a.value = i;
a.flag = 0;
if (i%3 == 0) a.flag = 1;
N.push_back(a);
}
N.erase(remove_if(N.begin(),N.end(),IsFlag()),N.end());
return 1;
}
Other than what others have said, I want to add, that you also need to
change "remove_if" to "std::remove_if". But I am not really sure about how
the lookup is done here, so you may very well not need it. Maybe someone
else can clarify.
regards
--
jb
(reply address in rot13, unscramble first)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]