Heterogenous Collections Using Variant

Learn how to use variants for heterogenous collections and access values using the std::get() function.

Variant use in heterogenous collections

Now that we have a variant that can store any provided list, we can expand this to a heterogeneous collection. We do this by simply creating a std::vector of our variant:

Get hands-on with 1200+ tech skills courses.