an example of C++ STL algorithm fill


👍 g++ -std=c++11 fill.cpp
👍 ./a.out    
0 0 0 0 0 
7 7 7 7 7 
👍 cat fill.cpp                      
#include <iostream>
#include <vector>
using namespace std;

ostream& operator<<(ostream &o, 
                    vector v){
  for(auto e : v)
    cout << e << ' ';
  return o;
}

int main() {
  vector<int> v(5, 0); 
  cout << v << endl;
  fill(v.begin(), v.end(), 7);
  cout << v << endl;
}