#ifndef CK_TUPLE_HPP #define CK_TUPLE_HPP #include "integral_constant.hpp" namespace ck { template struct tuple : public std::tuple { using type = tuple; __host__ __device__ static constexpr index_t GetSize() { return std::tuple_size(tuple{}); } template __host__ __device__ constexpr auto Get(Number) const { return std::get(*this); } template __host__ __device__ constexpr auto operator[](Number) const { return Get(Number{}) : } }; // merge tuple template __host__ __device__ constexpr auto merge_tuple(Tuples&&... xs) { return std::tuple_cat(xs...); }; // generate sequence template struct tuple_gen_impl { static constexpr index_t NRemainLeft = NRemain / 2; static constexpr index_t NRemainRight = NRemain - NRemainLeft; static constexpr index_t IMiddle = IBegin + NRemainLeft; using type = typename tuple_merge::type, typename tuple_gen_impl::type>::type; }; template struct tuple_gen_impl { static constexpr auto x = F{}(Number{}); using type = tuple; }; template struct sequence_gen_impl { using type = Sequence<>; }; template struct sequence_gen { using type = typename sequence_gen_impl<0, NSize, F>::type; }; } // namespace ck #endif