fork(1) download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <vector>
  4. #include <list>
  5. using namespace std;
  6.  
  7. template <typename T>
  8. vector<int> func(T buf)
  9. {
  10. vector<int> t;
  11. t.push_back(*next(buf, 0));
  12. t.push_back(*next(buf, 1));
  13.  
  14. return t;
  15. }
  16.  
  17. int main() {
  18.  
  19. list<int> ls;
  20. vector<int> v;
  21. ls.push_back(2);
  22. ls.push_back(111111);
  23. v.push_back(12);
  24. v.push_back(11);
  25.  
  26. vector<int> t1= func(v.begin());
  27. vector<int> t2= func(ls.begin());
  28.  
  29. cout<<t1[0]<<endl<<t1[1]<<endl;
  30. cout<<t2[0]<<endl<<t2[1]<<endl;
  31.  
  32. return 0;
  33. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
12
11
2
111111