language: C++11 (gcc-4.7.2)
date: 87 days 11 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <array>
#include <vector>
#include <iostream>
 
template <typename T>
void printAll(const T& v)
{
    for (const typename T::value_type& value : v)
        std::cout << value << std::endl;
}
 
int main()
{
    std::array<int, 10> a = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    printAll(a);
    
    std::vector<int> v = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
    printAll(v);
}