diff --git a/src/utils.hh b/src/utils.hh index fbf39e10..c441cdf3 100644 --- a/src/utils.hh +++ b/src/utils.hh @@ -14,6 +14,28 @@ std::unique_ptr make_unique(Args&&... args) return std::unique_ptr(new T(std::forward(args)...)); } +template +struct IndexSequence +{ + using Next = IndexSequence; +}; + +template +struct MakeIndexSequence +{ + using Type = typename MakeIndexSequence::Type::Next; +}; + +template<> +struct MakeIndexSequence<0> +{ + using Type = IndexSequence<>; +}; + +template +constexpr typename MakeIndexSequence::Type +make_index_sequence() { return typename MakeIndexSequence::Type{}; } + // *** Singleton *** // // Singleton helper class, every singleton type T should inherit