description | title | ms.date | f1_keywords | helpviewer_keywords | ||
---|---|---|---|---|---|---|
Learn more about: <optional> |
<optional> |
08/06/2019 |
|
|
Defines the container class template optional
and several supporting templates.
Header: <optional>
Namespace: std
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
.
Name | Description |
---|---|
make_optional | Makes an object optional. |
swap | Swaps the contained values of two optional objects. |
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. |
Name | Description |
---|---|
nullopt | An instance of nullopt_t for comparisons. |