Created
February 18, 2015 19:52
-
-
Save 1995eaton/bbbe12f2e36c732c2749 to your computer and use it in GitHub Desktop.
Multidimensional array class in C++11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <array> | |
template <typename T, int L, int ...R> | |
struct MultiArray : public std::array<typename MultiArray<T, R...>::type, L> { | |
using type = std::array<typename MultiArray<T, R...>::type, L>; | |
MultiArray() : std::array<typename MultiArray<T, R...>::type, L>() {} | |
}; | |
template <typename T, int L> | |
struct MultiArray<T, L> : public std::array<T, L> { | |
using type = std::array<T, L>; | |
MultiArray() : std::array<T, L>() {} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment