C++仿函数应用实例
#include
#include
#include
using namespace std; template
struct GT { GT (const T& a) : m_a(a) {} bool operator()(const T& left) { return left >= m_a; } T m_a; }; int main() { list
iLst; iLst.push_back(12); iLst.push_back(178); iLst.push_back(200); list
::iterator iter = find_if(iLst.begin(), iLst.end(), GT
(100)); if (iLst.end() != iter) { cout << "find" << endl; cout << *iter << endl; } else { cout << "not find" << endl; } return 0; }
函数指针调用与函数对象调用的等效性
#include <windows.h>
#include
#include
#include