Visiting Multiple Variants

This lessons discusses visiting multiple variants. Let's take a look at it in detail!

Variants And Overloading

std::visit allows you not only to visit one variant but many in the same call. However, it’s essential to know that with multiple variants, you have to implement function overloads taking as many arguments as the number of input variants. And you have to provide all the possible combination of types.

For example, for the following:

Get hands-on with 1200+ tech skills courses.