Exceptional C++ Style一书第四条阐述了std::mem_fun的相关问题,尝试了下述的代码。
for_each(l.begin(), l.end(), mem_fun(&list
copy(s1.begin(), s1.end(), ostream_iterator
copy(s2.begin(), s2.end(), ostream_iterator
no matching function for call to `mem_fun(
这个例子是从roguewave的STL文档中直接摘出来的例子,居然出错,百思不得其解。后来将这段代码放到Visual Stdio 2005 beta2中进行编译,顺利通过编译,运行也正确。
for_each(l.begin(), l.end(), mem_fun
D:/Dev/Dev-Cpp/bin>g++ --version
g++ (GCC) 3.4.2 (mingw-special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.