算数生成算法fill填充
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Print
{
public:
void operator()(int i)
{
cout << i << endl;
}
};
int main()
{
vector<int> v;
v.resize(10);
fill(v.begin(), v.end(), 10);
for_each(v.begin(), v.end(), Print());
return 0;
}
$ ./a.out
10
10
10
10
10
10
10
10
10
10