fork download
  1. #include <array>
  2. #include <vector>
  3. #include <iostream>
  4.  
  5. template <typename T>
  6. void printAll(const T& v)
  7. {
  8. for (const typename T::value_type& value : v)
  9. std::cout << value << std::endl;
  10. }
  11.  
  12. int main()
  13. {
  14. std::array<int, 10> a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  15. printAll(a);
  16.  
  17. std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  18. printAll(v);
  19. }
Success #stdin #stdout 0s 2984KB
stdin
Standard input is empty
stdout
1
2
3
4
5
6
7
8
9
10
1
2
3
4
5
6
7
8
9
10