I am trying to understand and use stl bind2nd, but getting compiler error. Could some one please identify as what I am doing wrong.
Any help will be appreciated.
Thanks Kaz.
#include <functional>
#include <algorithm>
#include <vector>
int MyIntCounter = 0;
class MyInt
{
int mId;
public:
MyInt():mId(++MyIntCounter){}
MyInt(int arg):mId(arg){}
bool operator()(const MyInt& rhs1 , const MyInt& rhs2)
{
return rhs1.mId == rhs2.mId == mId;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
std::vector<MyInt> ints;
for(int i = 0; i < 10; ++i) ints.push_back( MyInt() );
MyInt finder2(2), finder3(3);
std::find_if( ints.begin(), ints.end(),
std::bind2nd(finder2, finder3 ) );
return 0;
}


















