   bind2nd and ptr_fun in C++: compiling error
  Hello, folks,What is wrong with the following code. I got the following compiling error from VS 2008 prof:"error C2529: '_Left' : reference to reference is illegal"Thanks in advance.class Record {string name;long ssn;public:Record(string& s, long sn) : name(s), ssn(sn) {}string getName() const  { return name; }};bool name_key_eq( const Record& r, const char* name) {return (r.getName() == name);}void op_Record(list<Record>& lr) {typedef list<Record>::iterator LI;LI p = find_if(lr.begin(), lr.end(), bind2nd(ptr_fun(name_key_eq), "John Brown") ); // compiling error}[Edited by - Robert007 on April 18, 2010 11:46:12 AM]
  I am not sure but bind2nd should take directly the function:bind2nd(name_key_eq,"John Brown");  In the code the free function can not be passed Record by reference in the find_if() function. For it to work, the free function should be:bool name_key_eq( const Record r, const char* name) { // NOT const Record& rreturn (r.getName() == name);}[\source