Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
A variant object holds and manages a value. If the variant holds a value, that value's type has to be one of the template argument types given to variant. These template arguments are called alternatives.
Requirements
Header: <variant>
Namespace: std
Members
Operators
Name | Description |
---|---|
operator== | Tests if the variant object on the left side of the operator is equal to the variant object on the right side. |
operator!= | Tests if the variant object on the left side of the operator is not equal to the variant object on the right side. |
operator< | Tests if the variant object on the left side of the operator is less than the variant object on the right side. |
operator<= | Tests if the variant object on the left side of the operator is less than or equal to the variant object on the right side. |
operator> | Tests if the variant object on the left side of the operator is greater than the variant object on the right side. |
operator>= | Tests if the variant object on the left side of the operator is greater than or equal to the variant object on the right side. |
Functions
Name | Description |
---|---|
get | Gets the variant of an object. |
get_if | Gets the variant of an object if it exists. |
holds_alternative | Return true if a variant exists. |
swap | Swaps a variant. |
visit | Moves to the next variant. |
Classes
Name | Description |
---|---|
bad_variant_access | Objects thrown to report invalid accesses to the value of a variant object. |
variant | An object to either hold a value of one of its alternative types, or no value. |
Structs
Name | Description |
---|---|
hash | |
monostate | An alternative type for a variant to make the variant type default constructible. |
uses_allocator | |
variant_alternative | Assists the variant objects. |
variant_size | Assists the variant objects. |
Objects
Name | Description |
---|---|
variant_npos |