Is there any way to create a pre-defined type list, and use those types in a std::variant in c++ 17? Here is what I'm trying to do, it compiles, but doesn't work as I was hoping:
template < class ... Types > struct type_list {};
using valid_types = type_list< int16_t, int32_t, int64_t, double, std::string >;
using value_t = std::variant< valid_types >;
One way:
template<class... Types>
std::variant<Types...> as_variant(type_list<Types...>);
using value_t = decltype(as_variant(valid_types{}));