add nested_array

This commit is contained in:
bolero-MURAKAMI 2014-04-05 19:33:32 +09:00
parent f1555cb917
commit b2daf0262c
2 changed files with 47 additions and 0 deletions

View file

@ -15,5 +15,6 @@
#include <sprout/array/tuple.hpp> #include <sprout/array/tuple.hpp>
#include <sprout/array/make_array.hpp> #include <sprout/array/make_array.hpp>
#include <sprout/array/type_traits.hpp> #include <sprout/array/type_traits.hpp>
#include <sprout/array/nested_array.hpp>
#endif // #ifndef SPROUT_ARRAY_HPP #endif // #ifndef SPROUT_ARRAY_HPP

View file

@ -0,0 +1,46 @@
/*=============================================================================
Copyright (c) 2011-2014 Bolero MURAKAMI
https://github.com/bolero-MURAKAMI/Sprout
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
#ifndef SPROUT_ARRAY_NESTED_ARRAY_HPP
#define SPROUT_ARRAY_NESTED_ARRAY_HPP
#include <cstddef>
#include <sprout/config.hpp>
#include <sprout/array/array.hpp>
#include <sprout/type_traits/identity.hpp>
namespace sprout {
namespace detail {
template<typename T, std::size_t... Ns>
struct nested_array_t_impl;
template<typename T, std::size_t N>
struct nested_array_t_impl<T, N>
: public sprout::identity<sprout::array<T, N> >
{};
template<typename T, std::size_t N, std::size_t... Ms>
struct nested_array_t_impl<T, N, Ms...>
: public sprout::detail::nested_array_t_impl<sprout::array<T, N>, Ms...>
{};
} // namespace detail
//
// nested_array_t
//
template<typename T, std::size_t... Ns>
struct nested_array_t
: public sprout::detail::nested_array_t_impl<T, Ns...>
{};
#if SPROUT_USE_TEMPLATE_ALIASES
//
// nested_array
//
template<typename T, std::size_t... Ns>
using nested_array = typename sprout::nested_array_t<T, Ns...>::type;
#endif // #if SPROUT_USE_TEMPLATE_ALIASES
} // namespace sprout
#endif // #ifndef SPROUT_ARRAY_NESTED_ARRAY_HPP