Effective STL 学习笔记 39 ~ 41 */--> div.org-src-container { font-size: 85%; font-family: monospace; } pre.src { background-color:#2e3436; color:#fefffe; } p {font-size: 15px} li {font-size: 15px} Table of Contents Make Predicate pure Function Make Funct…
简单来将,仿函数(functor)就是一个重载了"()"运算符的struct或class,利用对象支持operator()的特性,来达到模拟函数调用效果的技术. 我们平时对一个集合类遍历的时候,例如vector,是这样做的: for(vector<int>::const_iterator iter = ivec.begin(); iter != ivec.end(); ++iter) { //do your whatever you want here } 例如下面的代码:…