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