Skip to content

Instantly share code, notes, and snippets.

@Fiona-J-W
Last active August 29, 2015 14:10
Show Gist options
  • Select an option

  • Save Fiona-J-W/ff5012611ebad9396999 to your computer and use it in GitHub Desktop.

Select an option

Save Fiona-J-W/ff5012611ebad9396999 to your computer and use it in GitHub Desktop.
multi_array
#ifndef MULTI_ARRAY_HPP
#define MULTI_ARRAY_HPP
#include <array>
#include <cstdint>
namespace multi {
namespace impl {
template<typename T, std::size_t Head, std::size_t... Tail>
struct multi_array_t {
using type = std::array<typename multi_array_t<T, Tail...>::type, Head>;
};
template<typename T, std::size_t Head>
struct multi_array_t<T, Head> {
using type = std::array<T, Head>;
};
} // namespace impl
template<typename T, std::size_t... Dimensions>
using multi_array = typename impl::multi_array_t<T, Dimensions...>::type;
} // namespace multi
#endif // MULTI_ARRAY_HPP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment