variant hold type

C++
template<typename T, typename VARIANT_T>
struct variant_member;

template<typename T, typename... ALL_T>
struct variant_member<T, std::variant<ALL_T...>> 
  : public std::disjunction<std::is_same<T, ALL_T>...> {};
  
// Using as: variant_member<TYPE, VARIANT>::value
Source

Also in C++: