fork(1) download
  1. #include <vector>
  2. #include <iterator>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. vector<int>& operator+=(vector<int>& v, int x) {
  8. for (auto a=begin(v); a!=end(v); ++a) {
  9. *a += x;
  10. }
  11. return v;
  12. }
  13.  
  14. int main() {
  15. vector<int> a = {1, 2, 3};
  16. a += 10;
  17. copy(begin(a), end(a), ostream_iterator<int>(cout, ", "));
  18. }
  19.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
11, 12, 13,