#ifndef SPROUT_INDEX_TUPLE_INDEX_N_HPP #define SPROUT_INDEX_TUPLE_INDEX_N_HPP #include #include #include #include #include namespace sprout { // // index_n // namespace detail { template struct index_n_next; template struct index_n_next> { public: typedef sprout::index_tuple type; }; template struct index_n_next2; template struct index_n_next2, Tail> { public: typedef sprout::index_tuple type; }; template struct index_n_impl; template struct index_n_impl< I, N, typename std::enable_if<(N == 0)>::type > { public: typedef sprout::index_tuple<> type; }; template struct index_n_impl< I, N, typename std::enable_if<(N == 1)>::type > { public: typedef sprout::index_tuple type; }; template struct index_n_impl< I, N, typename std::enable_if<(N > 1 && N % 2 == 0)>::type > : public sprout::detail::index_n_next< typename sprout::detail::index_n_impl::type > {}; template struct index_n_impl< I, N, typename std::enable_if<(N > 1 && N % 2 == 1)>::type > : public sprout::detail::index_n_next2< typename sprout::detail::index_n_impl::type, I > {}; } // namespace detail template struct index_n : public sprout::detail::make_indexes_helper< sprout::detail::index_n_impl > {}; } // namespace sprout #endif // #ifndef SPROUT_INDEX_TUPLE_INDEX_N_HPP