Changing the values
This lesson addresses the ways of changing values of the variant.
We'll cover the following
Changing Values of the variant
There are four ways to change the current value of the variant:
• the assignment operator
• emplace
• get
and then assign a new value for the currently active type
• a visitor (you cannot change the type, but you can change the value of the current alternative)
The important part is to know that everything is type-safe and also that the object lifetime is honoured.
Get hands-on with 1400+ tech skills courses.