why not std::not1 ?
//main.cpp
...
class IsFileAttributes{
public:
IsFileAttributes(const DWORD aim):aim_(aim){}
bool operator() (const fs::path arg){
using namespace wukexin;
string fname=arg.native_file_string();
DWORD attrib=GetFileAttributes(fname.c_str() );
std::cout<<fname<<"\n";
//std::cout<<"file="<<attrib<<"\tfiltrate="<<aim_<<"\n";
//std::cout<<"file="<<fileAttribToStr(attrib)<<"\tfiltrate="<<fileAttribToStr(aim_)<<"\n";
std::cout.setf(ios::boolalpha);
std::cout<<static_cast<bool>(aim_ & attrib)<<"\t"<<fname<<"\n";
return ( aim_ & attrib );
}
//private:
DWORD aim_;
};
...
if(vm.count("attribute") ){
const vector<string>& attribs = vm["attribute"].as< vector<string>
>();
DWORD attrib(0);
for(vector<string>::const_iterator
itr=attribs.begin();itr!=attribs.end();++itr){
attrib |= wukexin::stringToAttrib(*itr);
}
filtrate(fileList,IsFileAttributes(attrib) );
}
...
//help.h
//
template<class C, class P> void filtrate(C& c, P pred)
{
c.erase(std::remove_if(c.begin(), c.end(), std::not1(pred) ), c.end());
}
//vc 2003 error message
main.cpp
d:\backup\program\VC2003\include\functional(201) : error C2039:
??argument_type?? : ??????IsFileAttributes????????
main.cpp(31) : ??????IsFileAttributes????????
d:\backup\program\boost_1_34_1\../wukexin\help\help.h(18) : ??????????????????????????????std::unary_negate<_Fn1>????????
with
[
_Fn1=IsFileAttributes
]
main.cpp(171) : ????????????????????????????????void
filtrate<Container,IsFileAttributes>(C &,P)????????
with
[
C=Container,
P=IsFileAttributes
]
d:\backup\program\VC2003\include\functional(201) : error C2146: ???????? :
??????,??(??????????argument_type????????)
d:\backup\program\VC2003\include\functional(201) : error C2065:
??argument_type?? : ??????????????
d:\backup\program\VC2003\include\functional(201) : error C2976:
??std::unary_function?? : ????????????
d:\backup\program\VC2003\include\functional(20) : ??????std::unary_function????????
d:\backup\program\VC2003\include\functional(209) : error C2039:
??argument_type?? : ??????IsFileAttributes????????
main.cpp(31) : ??????IsFileAttributes????????
d:\backup\program\boost_1_34_1\../wukexin\help\help.h(18) : error C2664:
??std::remove_if?? : ?????????? 3 ????std::unary_negate<_Fn1>??????????std::unary_negate<_Fn1>??
with
[
_Fn1=IsFileAttributes
]
and
[
_Fn1=IsFileAttributes
]
?????????? class??std::unary_negate<_Fn1>???????????????????????????????????????? __gc ??????????????
with
[
_Fn1=IsFileAttributes
]