[ Web Proxy ]
URL:
Viewing: https://ko.cppreference.com/cpp/utility/optional [Back]  [Original]

std::optional - cppreference.com
cppreference.com

std::optional

cppreference.com
<tbody> </tbody>
<optional> .
template< class T > class optional;
(since C++14)

std::optional . .

{{tt|optional} . std::pair<T,bool> optional .

optional . , optional operator*() operator->() .

optional . optional engaged , disengaged .

optional engaged .:

  • T
  • engaged optional


disengaged .:

  • std::nullopt_t disengaged optional
  • std::nullopt_t disengaged optional


T - . Destructible .

Member type Definition
value_type T

constructs the optional object
(public member function) [edit]
if engaged, destroys the contained value
(public member function) [edit]
assigns contents
(public member function) [edit]
Observers
accesses the contained value
(public member function) [edit]
checks whether the object is in engaged state
(public member function) [edit]
returns the contained value
(public member function) [edit]
returns the contained value if engaged, another value otherwise
(public member function) [edit]
Modifiers
exchanges the contents
(public member function) [edit]
constructs the contained value in-place
(public member function) [edit]

Non-member functions

compares optional objects
(function template) [edit]
creates an optional object
(function template) [edit]
specializes the std::swap algorithm
(function) [edit]

specializes the std::hash algorithm
(class template specialization) [edit]

Web Proxy Viewer  |  New URL  |  Original Page