.TH "std::any" 3cxx "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::any \- A type-safe container of any type\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .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<\fBtypename\fP _Tp , \fBtypename\fP \fB_VTp\fP = _Decay_if_not_any<_Tp>, \fBtypename\fP \fB_Mgr\fP = _Manager<_VTp>, \fBenable_if_t\fP< is_copy_constructible_v< \fB_VTp\fP > &&!__is_in_place_type_v< \fB_VTp\fP >, 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<\fBtypename\fP _Tp , typename\&.\&.\&. _Args, \fBtypename\fP \fB_VTp\fP = decay_t<_Tp>, \fBtypename\fP \fB_Mgr\fP = _Manager<_VTp>, __any_constructible_t< \fB_VTp\fP, \fB_Args\fP &&\&.\&.\&. > = false> \fBany\fP (in_place_type_t< _Tp >, \fB_Args\fP &&\&.\&.\&. \fB__args\fP)" .br .RI "Construct with an object created from \fC__args\fP as the contained object\&. " .ti -1c .RI "template<\fBtypename\fP _Tp , \fBtypename\fP _Up , typename\&.\&.\&. _Args, \fBtypename\fP \fB_VTp\fP = decay_t<_Tp>, \fBtypename\fP \fB_Mgr\fP = _Manager<_VTp>, __any_constructible_t< \fB_VTp\fP, \fBinitializer_list\fP< _Up > &, \fB_Args\fP &&\&.\&.\&. > = false> \fBany\fP (in_place_type_t< _Tp >, \fBinitializer_list\fP< _Up > \fB__il\fP, \fB_Args\fP &&\&.\&.\&. \fB__args\fP)" .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<\fBtypename\fP _Tp , typename\&.\&.\&. _Args> __emplace_t< \fBdecay_t\fP< _Tp >, _Args\&.\&.\&. > \fBemplace\fP (\fB_Args\fP &&\&.\&.\&. \fB__args\fP)" .br .RI "Emplace with an object created from \fC__args\fP as the contained object\&. " .ti -1c .RI "template<\fBtypename\fP _Tp , \fBtypename\fP _Up , typename\&.\&.\&. _Args> __emplace_t< \fBdecay_t\fP< _Tp >, \fBinitializer_list\fP< _Up > &, \fB_Args\fP &&\&.\&.\&. > \fBemplace\fP (\fBinitializer_list\fP< _Up > \fB__il\fP, \fB_Args\fP &&\&.\&.\&. \fB__args\fP)" .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<\fBtypename\fP _Tp > \fBenable_if_t\fP< \fBis_copy_constructible\fP< \fB_Decay_if_not_any\fP< _Tp > >::value, \fBany\fP & > \fBoperator=\fP (_Tp &&\fB__rhs\fP)" .br .RI "Store a copy of \fC__rhs\fP as the contained object\&. " .ti -1c .RI "\fBany\fP & \fBoperator=\fP (\fBany\fP &&\fB__rhs\fP) noexcept" .br .RI "Move assignment operator\&. " .ti -1c .RI "\fBany\fP & \fBoperator=\fP (const \fBany\fP &\fB__rhs\fP)" .br .RI "Copy the state of another object\&. " .ti -1c .RI "\fBvoid\fP \fBreset\fP () noexcept" .br .RI "If not empty, destroy the contained object\&. " .ti -1c .RI "\fBvoid\fP \fBswap\fP (\fBany\fP &\fB__rhs\fP) 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 .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 \fBSince\fP .RS 4 C++17 .RE .PP .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\&. .SS "std::any::any (const \fBany\fP & __other)\fC [inline]\fP" .PP Copy constructor, copies the state of \fC__other\fP\&. .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 .SS "template<\fBtypename\fP _Tp , \fBtypename\fP \fB_VTp\fP = _Decay_if_not_any<_Tp>, \fBtypename\fP \fB_Mgr\fP = _Manager<_VTp>, \fBenable_if_t\fP< is_copy_constructible_v< \fB_VTp\fP > &&!__is_in_place_type_v< \fB_VTp\fP >, bool > = true> std::any::any (_Tp && __value)\fC [inline]\fP" .PP Construct with a copy of \fC__value\fP as the contained object\&. .SS "template<\fBtypename\fP _Tp , typename\&.\&.\&. _Args, \fBtypename\fP \fB_VTp\fP = decay_t<_Tp>, \fBtypename\fP \fB_Mgr\fP = _Manager<_VTp>, __any_constructible_t< \fB_VTp\fP, \fB_Args\fP &&\&.\&.\&. > = false> std::any::any (in_place_type_t< _Tp >, \fB_Args\fP &&\&.\&.\&. __args)\fC [inline]\fP, \fC [explicit]\fP" .PP Construct with an object created from \fC__args\fP as the contained object\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Up , typename\&.\&.\&. _Args, \fBtypename\fP \fB_VTp\fP = decay_t<_Tp>, \fBtypename\fP \fB_Mgr\fP = _Manager<_VTp>, __any_constructible_t< \fB_VTp\fP, \fBinitializer_list\fP< _Up > &, \fB_Args\fP &&\&.\&.\&. > = false> std::any::any (in_place_type_t< _Tp >, \fBinitializer_list\fP< _Up > __il, \fB_Args\fP &&\&.\&.\&. __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\&. .SS "std::any::~any ()\fC [inline]\fP" .PP Destructor, calls \fCreset()\fP .SH "Member Function Documentation" .PP .SS "template<\fBtypename\fP _Tp , typename\&.\&.\&. _Args> __emplace_t< \fBdecay_t\fP< _Tp >, _Args\&.\&.\&. > std::any::emplace (\fB_Args\fP &&\&.\&.\&. __args)\fC [inline]\fP" .PP Emplace with an object created from \fC__args\fP as the contained object\&. .SS "template<\fBtypename\fP _Tp , \fBtypename\fP _Up , typename\&.\&.\&. _Args> __emplace_t< \fBdecay_t\fP< _Tp >, \fBinitializer_list\fP< _Up > &, \fB_Args\fP &&\&.\&.\&. > std::any::emplace (\fBinitializer_list\fP< _Up > __il, \fB_Args\fP &&\&.\&.\&. __args)\fC [inline]\fP" .PP Emplace with an object created from \fC__il\fP and \fC__args\fP as the contained object\&. .SS "bool std::any::has_value () const\fC [inline]\fP, \fC [noexcept]\fP" .PP Reports whether there is a contained object or not\&. .SS "template<\fBtypename\fP _Tp > \fBenable_if_t\fP< \fBis_copy_constructible\fP< \fB_Decay_if_not_any\fP< _Tp > >::value, \fBany\fP & > std::any::operator= (_Tp && __rhs)\fC [inline]\fP" .PP Store a copy of \fC__rhs\fP as the contained object\&. .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 .SS "\fBany\fP & std::any::operator= (const \fBany\fP & __rhs)\fC [inline]\fP" .PP Copy the state of another object\&. .SS "\fBvoid\fP std::any::reset ()\fC [inline]\fP, \fC [noexcept]\fP" .PP If not empty, destroy the contained object\&. .SS "\fBvoid\fP std::any::swap (\fBany\fP & __rhs)\fC [inline]\fP, \fC [noexcept]\fP" .PP Exchange state with another object\&. .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\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.