fork download
  1. #include <algorithm>
  2. #include <iostream>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. vector<int> foo = {0, 42, 0, 42, 0, 42};
  9. replace(begin(foo), end(foo), static_cast<int>(foo.front()), 13);
  10.  
  11. for(const auto& i : foo) cout << i << '\t';
  12. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
13	42	13	42	13	42