Skip to content

Instantly share code, notes, and snippets.

@1995eaton
Created February 18, 2015 19:52
Show Gist options
  • Save 1995eaton/bbbe12f2e36c732c2749 to your computer and use it in GitHub Desktop.
Save 1995eaton/bbbe12f2e36c732c2749 to your computer and use it in GitHub Desktop.
Multidimensional array class in C++11
#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