how do i express concepts over a variadic template?

Simply enough:

namespace impl {
    template <class T>
    struct is_tuple_of_integrals
    : std::false_type { };
    template <std::integral... Ts>
    struct is_tuple_of_integrals<std::tuple<Ts...>>
    : std::true_type { };

template <class T>
concept tuple_of_integrals = impl::is_tuple_of_integrals<T>::value;

I do wonder whether the intermediate trait can be omitted, but absent concept specializations I don’t believe so.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top