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.
Defines the container class template optional
and several supporting templates.
Requirements
Header: <optional>
Namespace: std
Members
Operators
Name | Description |
---|---|
operator== | Tests if an object is equal to another object. |
operator!= | Tests if an object is not equal to another object. |
operator< | Tests if the object on the left is less than the object on the right. |
operator<= | Tests if the object on the left is less than or equal to the object on the right. |
operator> | Tests if the object on the left is greater than the object on the right. |
operator>= | Tests if the object on the left is greater than or equal to the object on the right. |
Note
In addition to relational compares, <optional> operators also support comparison with nullopt and T
.
Functions
Name | Description |
---|---|
make_optional | Makes an object optional. |
swap | Swaps the contained values of two optional objects. |
Classes and Structs
Name | Description |
---|---|
hash | Returns a hash of the contained object. |
optional class | Describes an object that may or may not hold a value. |
nullopt_t struct | Describes an object not holding a value. |
bad_optional_access class | Describes an object thrown as an exception to report an attempt to access a value not there. |
Objects
Name | Description |
---|---|
nullopt | An instance of nullopt_t for comparisons. |