Last active
August 29, 2015 14:10
-
-
Save Fiona-J-W/ff5012611ebad9396999 to your computer and use it in GitHub Desktop.
multi_array
This file contains hidden or 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
| #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