#ifndef SPROUT_INDEX_TUPLE_HPP #define SPROUT_INDEX_TUPLE_HPP #include #include namespace sprout { // // index_tuple // template struct index_tuple {}; // // index_range // template< std::ptrdiff_t First, std::ptrdiff_t Last, std::ptrdiff_t Step = 1, typename Acc = sprout::index_tuple<>, bool Break = (First >= Last) > struct index_range { typedef Acc type; }; template< std::ptrdiff_t First, std::ptrdiff_t Last, std::ptrdiff_t Step, std::ptrdiff_t... Indexes > struct index_range, false> : public sprout::index_range > {}; // // index_n // template< std::ptrdiff_t I, std::ptrdiff_t N, typename Acc = sprout::index_tuple<>, bool Break = (N == 0) > struct index_n { typedef Acc type; }; template< std::ptrdiff_t I, std::ptrdiff_t N, std::ptrdiff_t... Indexes > struct index_n, false> : public sprout::index_n > {}; } // namespace sprout #endif // #ifndef SPROUT_INDEX_TUPLE_HPP