#ifndef SPROUT_INDEX_TUPLE_INTEGER_RANGE_HPP #define SPROUT_INDEX_TUPLE_INTEGER_RANGE_HPP #include #include #include #include #include namespace sprout { // // integer_range // namespace detail { template struct integer_range_next_even; template struct integer_range_next_even, Next> : public sprout::integer_seq {}; template struct integer_range_next_odd; template struct integer_range_next_odd, Next, Tail> : public sprout::integer_seq {}; template struct integer_range_impl; template struct integer_range_impl< T, First, Step, N, typename std::enable_if<(N == 0)>::type > : public sprout::integer_seq {}; template struct integer_range_impl< T, First, Step, N, typename std::enable_if<(N == 1)>::type > : public sprout::integer_seq {}; template struct integer_range_impl< T, First, Step, N, typename std::enable_if<(N > 1 && N % 2 == 0)>::type > : public sprout::detail::integer_range_next_even< T, typename sprout::detail::integer_range_impl::type, N / 2 * Step > {}; template struct integer_range_impl< T, First, Step, N, typename std::enable_if<(N > 1 && N % 2 == 1)>::type > : public sprout::detail::integer_range_next_odd< T, typename sprout::detail::integer_range_impl::type, N / 2 * Step, First + (N - 1) * Step > {}; } // namespace detail template struct integer_range : public sprout::detail::make_indexes_helper< sprout::detail::integer_range_impl< T, First, Step, ((Last - First) + (Step - 1)) / Step > > {}; } // namespace sprout #endif // #ifndef SPROUT_INDEX_TUPLE_INTEGER_RANGE_HPP