fork(10) download
  1. #include <iostream>
  2. #include <iterator>
  3. #include <vector>
  4.  
  5. template <typename Iterator>
  6. void test(Iterator begin, const Iterator end) {
  7. std::copy(begin, end, std::ostream_iterator<decltype(*begin)>(std::cout, "\n"));
  8. }
  9.  
  10. template <typename Container>
  11. void test(const Container& in) {
  12. test(std::begin(in), std::end(in));
  13. }
  14.  
  15. int main() {
  16. std::vector<int> a = {1,2,3,4};
  17. test(a);
  18.  
  19. int b[3]={5,6,7};
  20. test(b);
  21. }
  22.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
1
2
3
4
5
6
7