I have the following type function to calculate whether some type T
is part of the list of types in an std::tuple
:
template<typename T, typename Tuple>
struct IsInTuple;
template<typename T, typename ...Ts>
struct IsInTuple<T, std::tuple<Ts...>>
{
static constexpr bool value = std::disjunction_v<std::is_same<T, Ts>...>;
};
My question is, is it possible to generalize this function for any variadic template type taking a variadic list of types so that it not only works for std::tuple
's, but for example also for std::variant
's?
std::tuple
with a template template parameter. – Interpenetrate