bind2nd with mem_fun_ref
-
// call member function printWithPrefix() for each element // - "person: " is passed as an argument to the member function for_each (coll.begin(), coll.end(), bind2nd((mem_fun_ref(&Person::printWithPrefix)), "person: ")); this code from a book, dont compile on vc++. I am disapointed. Please. What to do ? Vincent
-
// call member function printWithPrefix() for each element // - "person: " is passed as an argument to the member function for_each (coll.begin(), coll.end(), bind2nd((mem_fun_ref(&Person::printWithPrefix)), "person: ")); this code from a book, dont compile on vc++. I am disapointed. Please. What to do ? Vincent
I'm guessing that you're using Visual C++ 6.0. This version doesn't support a lot of the Standard C++ Library. I recommend that you either use a later version of Visual Studio or download the Visual C++ Toolkit 2003[^], which includes the compiler tools from VS.NET 2003. Stability. What an interesting concept. -- Chris Maunder
-
// call member function printWithPrefix() for each element // - "person: " is passed as an argument to the member function for_each (coll.begin(), coll.end(), bind2nd((mem_fun_ref(&Person::printWithPrefix)), "person: ")); this code from a book, dont compile on vc++. I am disapointed. Please. What to do ? Vincent
I had the same and searched the error without success. Recently I got VC7.1, I tried it again and it compiled perfectly! So change your compiler or dont't use mem_fun_ref. Christof