c++ for_each
来源:互联网 发布:法律大数据 编辑:程序博客网 时间:2024/06/07 09:56
//for_each example#include <iostream> // std::cout#include <algorithm> // std::for_each#include <vector> // std::vectorvoid myfunction (int i) { // function: std::cout << ' ' << i;}struct myclass { // function object type: void operator() (int i) {std::cout << ' ' << i;}} myobject;int main () { std::vector<int> myvector; myvector.push_back(10); myvector.push_back(20); myvector.push_back(30); std::cout << "myvector contains:"; for_each (myvector.begin(), myvector.end(), myfunction); std::cout << '\n'; // or: std::cout << "myvector contains:"; for_each (myvector.begin(), myvector.end(), myobject); std::cout << '\n'; return 0;}[来自:http://www.cplusplus.com/reference/algorithm/for_each/]
0 0
- for_each
- for_each
- for_each
- for_each
- for_each
- for_each
- for_each
- for_each
- for_each
- for_each
- for_each example
- STL for_each
- for_each用法
- STL::for_each
- for_each详解
- stl for_each()
- for_each()浅析
- for_each详解
- getCacheDir()、getFilesDir()、getExternalFilesDir()、getExternalCacheDir()的作用
- 在当前文件夹下打开cmd命令
- LeetCode | 1.Two Sum
- Windows7下将SVN注册为系统服务
- linux中安装python科学计算环境-numpy、scipy、matplotlib、OpenCV...
- c++ for_each
- 二叉树的遍历
- 有向树
- csdn markdown 编辑器 快捷键操作
- 电容的一些知识
- Git学习笔记
- 使两个元素重叠的方法,附带按钮搜索框的实例
- Android开发之Intent.Action
- nod-1483-化学变换