Answers for "variant hold type"

C++
0

variant hold type

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
Posted by: Guest on April-19-2020

Browse Popular Code Answers by Language