C++ Language/Type/Variant/TemplatedVariant

A variable  whose type is   can store a value that is either   or   or   (only one of those options at a time). Thus, this templated-variant variable is a modern alternative to a C. After assigning, you know that the variable is currently storing a   because   returns   and   returns   (0-based indexing of type options). Access that value by either  or by.

Additional information about templated-variant (includes interactive examples)