#ifndef SPROUT_INDEX_TUPLE_INTEGER_N_HPP #define SPROUT_INDEX_TUPLE_INTEGER_N_HPP #include #include #include #include #include namespace sprout { // // integer_n // namespace detail { template struct integer_n_next_even; template struct integer_n_next_even > : public sprout::integer_sequence {}; template struct integer_n_next_even_odd; template struct integer_n_next_even_odd, Tail> : public sprout::integer_sequence {}; template struct integer_n_impl; template struct integer_n_impl< T, I, N, typename std::enable_if<(N == 0)>::type > : public sprout::integer_sequence {}; template struct integer_n_impl< T, I, N, typename std::enable_if<(N == 1)>::type > : public sprout::integer_sequence {}; template struct integer_n_impl< T, I, N, typename std::enable_if<(N > 1 && N % 2 == 0)>::type > : public sprout::detail::integer_n_next_even< T, typename sprout::detail::integer_n_impl::type > {}; template struct integer_n_impl< T, I, N, typename std::enable_if<(N > 1 && N % 2 == 1)>::type > : public sprout::detail::integer_n_next_even_odd< T, typename sprout::detail::integer_n_impl::type, I > {}; template struct integer_n : public sprout::enable_make_indexes< sprout::detail::integer_n_impl > {}; } // namespace detail // // integer_range // #if SPROUT_USE_TEMPLATE_ALIASES template using integer_n = typename sprout::detail::integer_n::type; #else // #if SPROUT_USE_TEMPLATE_ALIASES template struct integer_n : public sprout::detail::integer_n {}; #endif // #if SPROUT_USE_TEMPLATE_ALIASES } // namespace sprout #endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_N_HPP