(public member function of ` std::optional<T> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/optional/dsc_constructor&action=edit)  
---|---  
[ (destructor)  ](/w/cpp/utility/optional/%7Eoptional "cpp/utility/optional/~optional") |  destroys the contained value, if there is one   
(public member function of ` std::optional<T> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/optional/dsc_destructor&action=edit)  
[ operator=  ](/w/cpp/utility/optional/operator%3D "cpp/utility/optional/operator=") |  assigns contents   
(public member function of ` std::optional<T> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/optional/dsc_operator%3D&action=edit)  
  
#####  Observers  
  
[ operator-> operator*  ](/w/cpp/utility/optional/operator* "cpp/utility/optional/operator*") |  accesses the contained value   
(public member function of ` std::optional<T> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/optional/dsc_operator*&action=edit)  
[ operator bool  has_value  ](/w/cpp/utility/optional/operator_bool "cpp/utility/optional/operator bool") |  checks whether the object contains a value   
(public member function of ` std::optional<T> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/optional/dsc_operator_bool&action=edit)  
  
#####  Modifiers  
  
[ reset  ](/w/cpp/utility/optional/reset "cpp/utility/optional/reset") |  destroys any contained value   
(public member function of ` std::optional<T> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/optional/dsc_reset&action=edit)  
[ emplace  ](/w/cpp/utility/optional/emplace "cpp/utility/optional/emplace") |  constructs the contained value in-place   
(public member function of ` std::optional<T> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/optional/dsc_emplace&action=edit)  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/copyable_wrapper&action=edit&section=4
"Edit section: Notes") ]  Notes

A  ` _copyable-box_ ` (until C++23)  ` _movable-box_ ` (since C++23)  does not
contain a value only if

  * ` T ` does not model [ ` movable ` ](/w/cpp/concepts/movable "cpp/concepts/movable") or [ ` copyable ` ](/w/cpp/concepts/copyable "cpp/concepts/copyable") , and an exception is thrown on move assignment or copy assignment respectively, or 
  * it is initialized/assigned from another valueless wrapper. 

Before [ P2325R3 ](https://wg21.link/P2325R3) , the wrapper was called `
_semiregular-box_ ` in the standard and always satisfied [ ` semiregular `
](/w/cpp/concepts/semiregular "cpp/concepts/semiregular") , as the default
constructor was always provided (which might construct a valueless wrapper).

[ Feature-test ](/w/cpp/utility/feature_test "cpp/utility/feature test") macro  |  Value  |  Std  |  Feature   
---|---|---|---  
[ ` __cpp_lib_ranges ` ](/w/cpp/feature_test#cpp_lib_ranges "cpp/feature test") |  201911L  |  (C++20)  |  [ Ranges library ](/w/cpp/ranges "cpp/ranges") and [ constrained algorithms ](/w/cpp/algorithm/ranges "cpp/algorithm/ranges")  
202106L  |  (C++20)    
(DR)  |  Non- [ default-initializable ](/w/cpp/concepts/default_initializable "cpp/concepts/default initializable") [ views ](/w/cpp/ranges/view "cpp/ranges/view")  
202207L  |  (C++23)  |  Relaxing [ range adaptors ](/w/cpp/ranges#Range_adaptors "cpp/ranges") to allow for move-only types   
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/copyable_wrapper&action=edit&section=5
"Edit section: Defect reports") ]  Defect reports

The following behavior-changing defect reports were applied retroactively to
previously published C++ standards.

DR  |  Applied to  |  Behavior as published  |  Correct behavior   
---|---|---|---  
[ P2325R3 ](https://wg21.link/P2325R3) |  C++20  |  if ` T ` is not [ ` default_initializable ` ](/w/cpp/concepts