Some simple code will demonstrate the problem:
class Foo {};
struct Bar {
bool foo(const Foo &f) const { return false; }
};
int main() {
Bar bar;
vector<Foo> v;
std::find_if(v.begin(), v.end(), std::bind1st(
std::mem_fun_ref(&Bar::foo), bar));
return 0;
}
Now, for this code, the VS2010 c++ compiler will complain: error C2535: bool std::binder1st<_Fn2>::operator()(const Foo&) const: member function already defined of declared
On earlier versions of Visual Studio, there would be two more compilation errors which are related to reference to reference issues. While these problems have gone in VS2010, the C2535 remains.
This question is similar to this one. As suggested by that post, i can use std::bind, or the boost library as alternatives. They work fine, but for now, i'd like to know is it possible to use the old bind1st style in this case, or is this problem more of a defect inherent in the STL functional framework? Thanks!