fork(3) download
  1. #include <iostream>
  2. #include <algorithm>
  3. using namespace std;
  4.  
  5. template <class Init1, class Init2, class OutIt>
  6. inline OutIt join_array(Init1 begin1, Init1 end1, Init2 begin2, Init2 end2, OutIt output)
  7. {
  8. return copy(begin2, end2, copy(begin1, end1, output));
  9. }
  10.  
  11. int main() {
  12. int a[] = {1,2,3,4};
  13. int b[] = {5,6,7,8};
  14. int c[8];
  15.  
  16. join_array(a, a+4, b, b+4, c);
  17.  
  18. for(int x : c) cout << x << endl;
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
1
2
3
4
5
6
7
8