.TH "std::optional< _Tp >" 3cxx "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::optional< _Tp > \- Class template for optional values\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits \fBstd::_Optional_base< _Tp, bool, bool >\fP, and _Enable_copy_move< is_copy_constructible_v< _Tp >, __and_v< is_copy_constructible< _Tp >, is_copy_assignable< _Tp > >, is_move_constructible_v< _Tp >, __and_v< is_move_constructible< _Tp >, is_move_assignable< _Tp > >, optional< _Tp > >\&. .PP Inherited by std::ranges::__detail::__box< _Pred >, std::ranges::__detail::__box< _Fp >, and std::ranges::__detail::__box< _Tp >\&. .SS "Public Types" .in +1c .ti -1c .RI "\fBusing\fP \fBvalue_type\fP = _Tp" .br .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "template<\fBtypename\fP _Up = _Tp, \fB_Requires\fP< \fB__not_self\fP< _Up >, \fB__not_tag\fP< _Up >, \fBis_constructible\fP< _Tp, _Up >, \fBis_convertible\fP< _Up, _Tp > > = true> constexpr \fBoptional\fP (_Up &&__t) noexcept(is_nothrow_constructible_v< _Tp, _Up >)" .br .ti -1c .RI "template<\fBtypename\fP _Up = _Tp, \fB_Requires\fP< \fB__not_self\fP< _Up >, \fB__not_tag\fP< _Up >, \fBis_constructible\fP< _Tp, _Up >, __not_< \fBis_convertible\fP< _Up, _Tp > > > = false> constexpr \fBoptional\fP (_Up &&__t) noexcept(is_nothrow_constructible_v< _Tp, _Up >)" .br .ti -1c .RI "template<\fBtypename\fP _Up , \fB_Requires\fP< __not_< \fBis_same\fP< _Tp, _Up > >, \fBis_constructible\fP< _Tp, const _Up & >, \fBis_convertible\fP< const _Up &, _Tp >, __not_< \fB__converts_from_optional\fP< _Tp, _Up > > > = true> constexpr \fBoptional\fP (const \fBoptional\fP< _Up > &__t) noexcept(is_nothrow_constructible_v< _Tp, const _Up & >)" .br .ti -1c .RI "template<\fBtypename\fP _Up , \fB_Requires\fP< __not_< \fBis_same\fP< _Tp, _Up > >, \fBis_constructible\fP< _Tp, const _Up & >, __not_< \fBis_convertible\fP< const _Up &, _Tp > >, __not_< \fB__converts_from_optional\fP< _Tp, _Up > > > = false> constexpr \fBoptional\fP (const \fBoptional\fP< _Up > &__t) noexcept(is_nothrow_constructible_v< _Tp, const _Up & >)" .br .ti -1c .RI "template > = false> constexpr \fBoptional\fP (in_place_t, \fB_Args\fP &&\&.\&.\&. \fB__args\fP) noexcept(is_nothrow_constructible_v< _Tp, _Args\&.\&.\&. >)" .br .ti -1c .RI "template<\fBtypename\fP _Up , typename\&.\&.\&. _Args, \fB_Requires\fP< \fBis_constructible\fP< _Tp, \fBinitializer_list\fP< _Up > &, _Args\&.\&.\&. > > = false> constexpr \fBoptional\fP (in_place_t, \fBinitializer_list\fP< _Up > \fB__il\fP, \fB_Args\fP &&\&.\&.\&. \fB__args\fP) noexcept(is_nothrow_constructible_v< _Tp, \fBinitializer_list\fP< _Up > &, _Args\&.\&.\&. >)" .br .ti -1c .RI "constexpr \fBoptional\fP (\fBnullopt_t\fP) noexcept" .br .ti -1c .RI "template<\fBtypename\fP _Up , \fB_Requires\fP< __not_< \fBis_same\fP< _Tp, _Up > >, \fBis_constructible\fP< _Tp, _Up >, \fBis_convertible\fP< _Up, _Tp >, __not_< \fB__converts_from_optional\fP< _Tp, _Up > > > = true> constexpr \fBoptional\fP (\fBoptional\fP< _Up > &&__t) noexcept(is_nothrow_constructible_v< _Tp, _Up >)" .br .ti -1c .RI "template<\fBtypename\fP _Up , \fB_Requires\fP< __not_< \fBis_same\fP< _Tp, _Up > >, \fBis_constructible\fP< _Tp, _Up >, __not_< \fBis_convertible\fP< _Up, _Tp > >, __not_< \fB__converts_from_optional\fP< _Tp, _Up > > > = false> constexpr \fBoptional\fP (\fBoptional\fP< _Up > &&__t) noexcept(is_nothrow_constructible_v< _Tp, _Up >)" .br .ti -1c .RI "template constexpr \fBenable_if_t\fP< is_constructible_v< _Tp, _Args\&.\&.\&. >, _Tp & > \fBemplace\fP (\fB_Args\fP &&\&.\&.\&. \fB__args\fP) noexcept(is_nothrow_constructible_v< _Tp, _Args\&.\&.\&. >)" .br .ti -1c .RI "template<\fBtypename\fP _Up , typename\&.\&.\&. _Args> constexpr \fBenable_if_t\fP< is_constructible_v< _Tp, \fBinitializer_list\fP< _Up > &, _Args\&.\&.\&. >, _Tp & > \fBemplace\fP (\fBinitializer_list\fP< _Up > \fB__il\fP, \fB_Args\fP &&\&.\&.\&. \fB__args\fP) noexcept(is_nothrow_constructible_v< _Tp, \fBinitializer_list\fP< _Up > &, _Args\&.\&.\&. >)" .br .ti -1c .RI "constexpr bool \fBhas_value\fP () const noexcept" .br .ti -1c .RI "constexpr \fBoperator bool\fP () const noexcept" .br .ti -1c .RI "constexpr _Tp && \fBoperator*\fP () &&noexcept" .br .ti -1c .RI "constexpr _Tp & \fBoperator*\fP () &noexcept" .br .ti -1c .RI "constexpr const _Tp && \fBoperator*\fP () const &&noexcept" .br .ti -1c .RI "constexpr const _Tp & \fBoperator*\fP () const &noexcept" .br .ti -1c .RI "constexpr const _Tp * \fBoperator\->\fP () const noexcept" .br .ti -1c .RI "constexpr _Tp * \fBoperator\->\fP () noexcept" .br .ti -1c .RI "template<\fBtypename\fP _Up = _Tp> constexpr \fBenable_if_t\fP< \fB__and_v\fP< \fB__not_self\fP< _Up >, __not_< __and_< \fBis_scalar\fP< _Tp >, \fBis_same\fP< _Tp, \fBdecay_t\fP< _Up > > > >, \fBis_constructible\fP< _Tp, _Up >, \fBis_assignable\fP< _Tp &, _Up > >, \fBoptional\fP & > \fBoperator=\fP (_Up &&\fB__u\fP) noexcept(\fB__and_v\fP< \fBis_nothrow_constructible\fP< _Tp, _Up >, \fBis_nothrow_assignable\fP< _Tp &, _Up > >)" .br .ti -1c .RI "template<\fBtypename\fP _Up > constexpr \fBenable_if_t\fP< \fB__and_v\fP< __not_< \fBis_same\fP< _Tp, _Up > >, \fBis_constructible\fP< _Tp, const _Up & >, \fBis_assignable\fP< _Tp &, const _Up & >, __not_< \fB__converts_from_optional\fP< _Tp, _Up > >, __not_< \fB__assigns_from_optional\fP< _Tp, _Up > > >, \fBoptional\fP & > \fBoperator=\fP (const \fBoptional\fP< _Up > &\fB__u\fP) noexcept(\fB__and_v\fP< \fBis_nothrow_constructible\fP< _Tp, const _Up & >, \fBis_nothrow_assignable\fP< _Tp &, const _Up & > >)" .br .ti -1c .RI "constexpr \fBoptional\fP & \fBoperator=\fP (\fBnullopt_t\fP) noexcept" .br .ti -1c .RI "template<\fBtypename\fP _Up > constexpr \fBenable_if_t\fP< \fB__and_v\fP< __not_< \fBis_same\fP< _Tp, _Up > >, \fBis_constructible\fP< _Tp, _Up >, \fBis_assignable\fP< _Tp &, _Up >, __not_< \fB__converts_from_optional\fP< _Tp, _Up > >, __not_< \fB__assigns_from_optional\fP< _Tp, _Up > > >, \fBoptional\fP & > \fBoperator=\fP (\fBoptional\fP< _Up > &&\fB__u\fP) noexcept(\fB__and_v\fP< \fBis_nothrow_constructible\fP< _Tp, _Up >, \fBis_nothrow_assignable\fP< _Tp &, _Up > >)" .br .ti -1c .RI "constexpr \fBvoid\fP \fBreset\fP () noexcept" .br .ti -1c .RI "constexpr \fBvoid\fP \fBswap\fP (\fBoptional\fP &__other) noexcept(is_nothrow_move_constructible_v< _Tp > &&\fBis_nothrow_swappable_v\fP< _Tp >)" .br .ti -1c .RI "constexpr _Tp & \fBvalue\fP () &" .br .ti -1c .RI "constexpr _Tp && \fBvalue\fP () &&" .br .ti -1c .RI "constexpr const _Tp & \fBvalue\fP () const &" .br .ti -1c .RI "constexpr const _Tp && \fBvalue\fP () const &&" .br .ti -1c .RI "template<\fBtypename\fP _Up > constexpr _Tp \fBvalue_or\fP (_Up &&\fB__u\fP) &&" .br .ti -1c .RI "template<\fBtypename\fP _Up > constexpr _Tp \fBvalue_or\fP (_Up &&\fB__u\fP) const &" .br .in -1c .SH "Detailed Description" .PP .SS "template<\fBtypename\fP _Tp> .br class std::optional< _Tp >"Class template for optional values\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.