STL_5: 仿函数
来源:互联网 发布:ab模板源码 百度网盘 编辑:程序博客网 时间:2024/06/06 03:54
http://blog.csdn.net/tianshuai1111/article/details/7687983
- 函数对象
//函数为参数void print(int elem){cout <<elem << '';}int main(){ vector<int> coll; for(int i=1;i<=9;++i) coll.push_back(i); for_each(coll.begin(),coll.end(),print); cout<<endl;}
//函数对象版本class PrintInt{ public: void operator()(int elem) const { cout<<elem<<''; }};int main(){ vector<int> coll; for(int i=1;i<=9;++i) coll.push_back(i); for_each(coll.begin(),coll.end(),PrintInt()); count <<endl;}
class x{ public: return-value operator()(arguments) const; ....};X fo; //当对象来调用fo(arg1,arg2);fo.operator()(arg1,arg2)
- 仿函数速度快
- 重载()
0 0
- STL_5: 仿函数
- STL_5
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- 仿函数
- Regularization of Deep or Distributed Models
- 《信息检索导论》读书笔记
- 经验之谈—自定义tabbar(继承于UITabBar)
- Java基础--面向对象(封装、构造函数、构造代码块、this关键字)
- spring MVC中ajax请求路径
- STL_5: 仿函数
- javaWeb通过POST来下载文件
- 关于有偿提供拼图响应式后台的通知
- 【jQuery】:first-child子元素过滤选择器
- python网络爬虫的记录
- Android高级控件----AdapterView与Adapter
- Linux 初始化 init 系统,第 1 部分: sysvinit
- 例题5-1 UVA 11292 The Dragon of Loowater勇者斗恶龙
- docker安装gitlab记录