容器遍历
- different-ways-to-iterate-over-a-set-in-c 里面综合分析了多个方法,
-
- 使用 std for_each 可以对容器遍历
- 可以避免使用迭代器
set
- 遍历每个元素
map
- 遍历的是一个pair
例子
// C++ program to implement
// the above approach
#include<bits/stdc++
// C++ program to implement
// the above approach
#include<bits/stdc++