1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
#include <iostream>
using namespace std;
#include <type_traits>
#include <array>
using TCount0 = array<int, 3>;
using TCount1 = std::array<TCount0, 2>;
using TCount2 = std::array<TCount1, 2>;
template<class T, std::size_t N>
struct is_array<std::array<T, N>> : std::true_type {};
template <typename T>
void PrintArray(T& A) {
if (is_array<T>::value)
for(auto& e : A)
PrintArray(e);
}
template<>
void PrintArray(int& e)
{
cout << e << " ";
}
int main()
{
TCount2 Cnt = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
PrintArray(Cnt);
}
| |