diff options
Diffstat (limited to 'include/yacppdic/detail/internal/tuple_indices.hpp')
-rw-r--r-- | include/yacppdic/detail/internal/tuple_indices.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/yacppdic/detail/internal/tuple_indices.hpp b/include/yacppdic/detail/internal/tuple_indices.hpp new file mode 100644 index 0000000..3a367b6 --- /dev/null +++ b/include/yacppdic/detail/internal/tuple_indices.hpp @@ -0,0 +1,39 @@ +#pragma once + +#include <cstddef> + +namespace yacppdic::internal +{ + +template <std::size_t...> +class TupleIndices +{ +}; + +template <typename IdxType, IdxType... Values> +class IntegerSequence +{ +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 +{ +public: + using type = MakeIndices<SizeOne, SizeTwo>; +}; + +} // namespace yacppdic::internal |