diff options
Diffstat (limited to 'include/yacppdic/detail/internal/tuple_indices.hpp')
-rw-r--r-- | include/yacppdic/detail/internal/tuple_indices.hpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/include/yacppdic/detail/internal/tuple_indices.hpp b/include/yacppdic/detail/internal/tuple_indices.hpp index 3a367b6..f2308e6 100644 --- a/include/yacppdic/detail/internal/tuple_indices.hpp +++ b/include/yacppdic/detail/internal/tuple_indices.hpp @@ -11,29 +11,27 @@ class TupleIndices }; template <typename IdxType, IdxType... Values> -class IntegerSequence +class TupleIndicesIntSequence { public: - template < - template <typename OIdxType, OIdxType...> - typename ToIndexSeq, - typename ToIndexType> - using Convert = ToIndexSeq<ToIndexType, Values...>; - template <std::size_t Sp> using ToTupleIndices = TupleIndices<(Values + Sp)...>; }; -template <std::size_t SizeOne, std::size_t SizeTwo> -using MakeIndices = - typename __make_integer_seq<IntegerSequence, std::size_t, SizeOne - SizeTwo>:: - template ToTupleIndices<SizeTwo>; - -template <std::size_t SizeOne, std::size_t SizeTwo = 0> -requires(SizeTwo <= SizeOne) class MakeTupleIndices +template <std::size_t EndIndex, std::size_t StartIndex> +using MakeIndices = typename +#if __has_builtin(__make_integer_seq) + __make_integer_seq<TupleIndicesIntSequence, std::size_t, EndIndex - StartIndex> +#else + TupleIndicesIntSequence<std::size_t, __integer_pack(EndIndex - StartIndex)...> +#endif + ::template ToTupleIndices<StartIndex>; + +template <std::size_t EndIndex, std::size_t StartIndex = 0> +requires(StartIndex <= EndIndex) class MakeTupleIndices { public: - using type = MakeIndices<SizeOne, SizeTwo>; + using type = MakeIndices<EndIndex, StartIndex>; }; } // namespace yacppdic::internal |