class template
` _copyable-box_ ` (until C++23)  ` _movable-box_ ` (since C++23)  . The name
shown here is for exposition purposes only.

The wrapper behaves exactly like  [ std::  optional
](http://en.cppreference.com/w/cpp/utility/optional) < T  > , except that the
default constructor, copy assignment operator, and move assignment operator
are (conditionally) different from those of  [ std::optional
](/w/cpp/utility/optional "cpp/utility/optional") , which augments ` T ` with
assignability when needed and makes it always satisfy [ ` copyable `
](/w/cpp/concepts/copyable "cpp/concepts/copyable") or [ ` movable `
](/w/cpp/concepts/movable "cpp/concepts/movable") (since C++23)  .

If ` T ` is already [ ` copyable ` ](/w/cpp/concepts/copyable "cpp/concepts/copyable") , or both  [ std::  is_nothrow_move_constructible_v  ](http://en.cppreference.com/w/cpp/types/is_move_constructible) < T  > and  [ std::  is_nothrow_copy_constructible_v  ](http://en.cppreference.com/w/cpp/types/is_copy_constructible) < T  > are  true  ,  /*copyable-box*/  < T  > may store only a ` T ` object, because it always contains a value.  |  (until C++23)   
---|---  
If ` T `

  * is already [ ` copyable ` ](/w/cpp/concepts/copyable "cpp/concepts/copyable") , or 
  * is [ ` copy_constructible ` ](/w/cpp/concepts/copy_constructible "cpp/concepts/copy constructible") and both  [ std::  is_nothrow_move_constructible_v  ](http://en.cppreference.com/w/cpp/types/is_move_constructible) < T  > and  [ std::  is_nothrow_copy_constructible_v  ](http://en.cppreference.com/w/cpp/types/is_copy_constructible) < T  > are  true  , or 
  * does not satisfy [ ` copy_constructible ` ](/w/cpp/concepts/copy_constructible "cpp/concepts/copy constructible") but satisfies [ ` movable ` ](/w/cpp/concepts/movable "cpp/concepts/movable") , or 
  * does not satisfy [ ` copy_constructible ` ](/w/cpp/concepts/copy_constructible "cpp/concepts/copy constructible") but  [ std::  is_nothrow_move_constructible_v  ](http://en.cppreference.com/w/cpp/types/is_move_constructible) < T  > is  true  , 

/*movable-box*/  < T  > may store only a ` T ` object, because it always contains a value.  |  (since C++23)   
  
##  Contents

  * 1  Template parameters 
  * 2  Member functions 
  * 3  Default constructor 
  * 4  Assignment operators 
  * 5  Members identical to  std::  optional 
    * 5.1  Member functions 
      * 5.1.1  Observers 
      * 5.1.2  Modifiers 
    * 5.2  Notes 
    * 5.3  Defect reports 
    * 5.4  See also 

  
---  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/copyable_wrapper&action=edit&section=1
"Edit section: Template parameters") ]  Template parameters

T  |  \-  |  the type of the contained value, must be an object type that models  [ ` copy_constructible ` ](/w/cpp/concepts/copy_constructible "cpp/concepts/copy constructible") (until C++23)  [ ` move_constructible ` ](/w/cpp/concepts/move_constructible "cpp/concepts/move constructible") (since C++23)   
---|---|---  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/copyable_wrapper&action=edit&section=2
"Edit section: Member functions") ]  Member functions

##  Default constructor

constexpr  /*copyable-box*/  (  )  noexcept  (  [ std::
is_nothrow_default_constructible_v
](http://en.cppreference.com/w/cpp/types/is_default_constructible) < T  > )  
requires [ std::  default_initializable
](http://en.cppreference.com/w/cpp/concepts/default_initializable) < T  >  
:  /*copyable-box*/  (  [ std::  in_place  ](http://en.cppreference.com/w/cpp/utility/in_place) )  {  }  |  |  (since C++20)    
(until C++23)  
---|---|---  
constexpr  /*movable-box*/  (  )  noexcept  (  [ std::
is_nothrow_default_constructible_v
](http://en.cppreference.com/w/cpp/types/is_default_constructible) < T  > )  
requires [ std::  default_initializable
](http://en.cppreference.com/w/cpp/concepts/default_initializable) < T  >  
:  /*movable-box*/  (  [ std::  in_place  ](http://en.cppreference.com/w/cpp/utility/in_place) )  {  }  |  |  (since