.TH "std::any" 3cxx "Wed Jul 28 2021" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::any \- A type-safe container of any type\&. .SH SYNOPSIS .br .PP .SS "Public Member Functions" .in +1c .ti -1c .RI "constexpr \fBany\fP () noexcept" .br .RI "Default constructor, creates an empty object\&. " .ti -1c .RI "template, typename _Mgr = _Manager<_VTp>, enable_if_t< is_copy_constructible< _VTp >::value &&!__is_in_place_type< _VTp >::value, bool > = true> \fBany\fP (_Tp &&__value)" .br .RI "Construct with a copy of \fC__value\fP as the contained object\&. " .ti -1c .RI "\fBany\fP (\fBany\fP &&__other) noexcept" .br .RI "Move constructor, transfer the state from \fC__other\fP\&. " .ti -1c .RI "\fBany\fP (const \fBany\fP &__other)" .br .RI "Copy constructor, copies the state of \fC__other\fP\&. " .ti -1c .RI "template, typename _Mgr = _Manager<_VTp>, __any_constructible_t< _VTp, _Args &&\&.\&.\&. > = false> \fBany\fP (in_place_type_t< _Tp >, _Args &&\&.\&.\&. __args)" .br .RI "Construct with an object created from \fC__args\fP as the contained object\&. " .ti -1c .RI "template, typename _Mgr = _Manager<_VTp>, __any_constructible_t< _VTp, initializer_list< _Up > &, _Args &&\&.\&.\&. > = false> \fBany\fP (in_place_type_t< _Tp >, \fBinitializer_list\fP< _Up > __il, _Args &&\&.\&.\&. __args)" .br .RI "Construct with an object created from \fC__il\fP and \fC__args\fP as the contained object\&. " .ti -1c .RI "\fB~any\fP ()" .br .RI "Destructor, calls \fCreset()\fP " .ti -1c .RI "template __emplace_t< \fBdecay_t\fP< _Tp >, _Args\&.\&.\&. > \fBemplace\fP (_Args &&\&.\&.\&. __args)" .br .RI "Emplace with an object created from \fC__args\fP as the contained object\&. " .ti -1c .RI "template __emplace_t< \fBdecay_t\fP< _Tp >, \fBinitializer_list\fP< _Up > &, _Args &&\&.\&.\&. > \fBemplace\fP (\fBinitializer_list\fP< _Up > __il, _Args &&\&.\&.\&. __args)" .br .RI "Emplace with an object created from \fC__il\fP and \fC__args\fP as the contained object\&. " .ti -1c .RI "bool \fBhas_value\fP () const noexcept" .br .RI "Reports whether there is a contained object or not\&. " .ti -1c .RI "template \fBenable_if_t\fP< \fBis_copy_constructible\fP< _Decay_if_not_any< _Tp > >::value, \fBany\fP & > \fBoperator=\fP (_Tp &&__rhs)" .br .RI "Store a copy of \fC__rhs\fP as the contained object\&. " .ti -1c .RI "\fBany\fP & \fBoperator=\fP (\fBany\fP &&__rhs) noexcept" .br .RI "Move assignment operator\&. " .ti -1c .RI "\fBany\fP & \fBoperator=\fP (const \fBany\fP &__rhs)" .br .RI "Copy the state of another object\&. " .ti -1c .RI "void \fBreset\fP () noexcept" .br .RI "If not empty, destroy the contained object\&. " .ti -1c .RI "void \fBswap\fP (\fBany\fP &__rhs) noexcept" .br .RI "Exchange state with another object\&. " .ti -1c .RI "const \fBtype_info\fP & \fBtype\fP () const noexcept" .br .RI "The \fCtypeid\fP of the contained object, or \fCtypeid(void)\fP if empty\&. " .in -1c .SS "Static Public Member Functions" .in +1c .ti -1c .RI "template static constexpr bool \fB__is_valid_cast\fP ()" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "template void * \fB__any_caster\fP (const \fBany\fP *__any)" .br .in -1c .SH "Detailed Description" .PP A type-safe container of any type\&. An \fCany\fP object's state is either empty or it stores a contained object of CopyConstructible type\&. .PP Definition at line 77 of file any\&. .SH "Constructor & Destructor Documentation" .PP .SS "constexpr std::any::any ()\fC [inline]\fP, \fC [constexpr]\fP, \fC [noexcept]\fP" .PP Default constructor, creates an empty object\&. .PP Definition at line 150 of file any\&. .SS "std::any::any (const \fBany\fP & __other)\fC [inline]\fP" .PP Copy constructor, copies the state of \fC__other\fP\&. .PP Definition at line 153 of file any\&. .SS "std::any::any (\fBany\fP && __other)\fC [inline]\fP, \fC [noexcept]\fP" .PP Move constructor, transfer the state from \fC__other\fP\&. .PP \fBPostcondition\fP .RS 4 \fC!__other\fP\&.has_value() (this postcondition is a GNU extension) .RE .PP .PP Definition at line 170 of file any\&. .SS "template, typename _Mgr = _Manager<_VTp>, enable_if_t< is_copy_constructible< _VTp >::value &&!__is_in_place_type< _VTp >::value, bool > = true> std::any::any (_Tp && __value)\fC [inline]\fP" .PP Construct with a copy of \fC__value\fP as the contained object\&. .PP Definition at line 187 of file any\&. .SS "template, typename _Mgr = _Manager<_VTp>, __any_constructible_t< _VTp, _Args &&\&.\&.\&. > = false> std::any::any (in_place_type_t< _Tp >, _Args &&\&.\&.\&. __args)\fC [inline]\fP, \fC [explicit]\fP" .PP Construct with an object created from \fC__args\fP as the contained object\&. .PP Definition at line 198 of file any\&. .SS "template, typename _Mgr = _Manager<_VTp>, __any_constructible_t< _VTp, initializer_list< _Up > &, _Args &&\&.\&.\&. > = false> std::any::any (in_place_type_t< _Tp >, \fBinitializer_list\fP< _Up > __il, _Args &&\&.\&.\&. __args)\fC [inline]\fP, \fC [explicit]\fP" .PP Construct with an object created from \fC__il\fP and \fC__args\fP as the contained object\&. .PP Definition at line 211 of file any\&. .SS "std::any::~any ()\fC [inline]\fP" .PP Destructor, calls \fCreset()\fP .PP Definition at line 218 of file any\&. .SH "Member Function Documentation" .PP .SS "template __emplace_t<\fBdecay_t\fP<_Tp>, _Args\&.\&.\&.> std::any::emplace (_Args &&\&.\&.\&. __args)\fC [inline]\fP" .PP Emplace with an object created from \fC__args\fP as the contained object\&. .PP Definition at line 262 of file any\&. .SS "template __emplace_t<\fBdecay_t\fP<_Tp>, \fBinitializer_list\fP<_Up>&, _Args&&\&.\&.\&.> std::any::emplace (\fBinitializer_list\fP< _Up > __il, _Args &&\&.\&.\&. __args)\fC [inline]\fP" .PP Emplace with an object created from \fC__il\fP and \fC__args\fP as the contained object\&. .PP Definition at line 275 of file any\&. .SS "bool std::any::has_value () const\fC [inline]\fP, \fC [noexcept]\fP" .PP Reports whether there is a contained object or not\&. .PP Definition at line 329 of file any\&. .SS "template \fBenable_if_t\fP<\fBis_copy_constructible\fP<_Decay_if_not_any<_Tp> >::value, \fBany\fP&> std::any::operator= (_Tp && __rhs)\fC [inline]\fP" .PP Store a copy of \fC__rhs\fP as the contained object\&. .PP Definition at line 253 of file any\&. .SS "\fBany\fP& std::any::operator= (\fBany\fP && __rhs)\fC [inline]\fP, \fC [noexcept]\fP" .PP Move assignment operator\&. .PP \fBPostcondition\fP .RS 4 \fC!__rhs\fP\&.has_value() (not guaranteed for other implementations) .RE .PP .PP Definition at line 236 of file any\&. .SS "\fBany\fP& std::any::operator= (const \fBany\fP & __rhs)\fC [inline]\fP" .PP Copy the state of another object\&. .PP Definition at line 224 of file any\&. .SS "void std::any::reset ()\fC [inline]\fP, \fC [noexcept]\fP" .PP If not empty, destroy the contained object\&. .PP Definition at line 287 of file any\&. .SS "void std::any::swap (\fBany\fP & __rhs)\fC [inline]\fP, \fC [noexcept]\fP" .PP Exchange state with another object\&. .PP Definition at line 297 of file any\&. .SS "const \fBtype_info\fP& std::any::type () const\fC [inline]\fP, \fC [noexcept]\fP" .PP The \fCtypeid\fP of the contained object, or \fCtypeid(void)\fP if empty\&. .PP Definition at line 333 of file any\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.