BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsl::optional< t_TYPE > Class Template Reference
Inheritance diagram for bsl::optional< t_TYPE >:
bdlb::NullableValue< balb::Choice1 > bdlb::NullableValue< balb::Choice3 > bdlb::NullableValue< double > bdlb::NullableValue< bsl::basic_string > bdlb::NullableValue< Enumerated::Value > bdlb::NullableValue< bool > bdlb::NullableValue< bsl::vector< char > > bdlb::NullableValue< bdlt::DatetimeTz > bdlb::NullableValue< balb::CustomString > bdlb::NullableValue< int > bdlb::NullableValue< unsigned int > bdlb::NullableValue< unsigned char > bdlb::NullableValue< balb::CustomInt > bdlb::NullableValue< balb::SequenceWithAnonymityChoice2 > bdlb::NullableValue< s_baltst::MySequenceWithNillableIntSequenceArraySequence > bdlb::NullableValue< s_baltst::MySequenceWithNillableStringSequenceArraySequence > bdlb::NullableValue< s_baltst::MySequence > bdlb::NullableValue< s_baltst::MySequenceWithNullableAnonymousChoiceChoice > bdlb::NullableValue< bdldfp::Decimal_Type64 > bdlb::NullableValue< s_baltst::Choice1 > bdlb::NullableValue< s_baltst::Choice3 > bdlb::NullableValue< s_baltst::CustomString > bdlb::NullableValue< s_baltst::Enumerated::Value > bdlb::NullableValue< s_baltst::CustomInt > bdlb::NullableValue< s_baltst::SequenceWithAnonymityChoice2 >

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION_IF (optional, BloombergLP::bslma::UsesBslmaAllocator, BloombergLP::bslma::UsesBslmaAllocator< t_TYPE >::value)
 
 BSLMF_NESTED_TRAIT_DECLARATION_IF (optional, BloombergLP::bslmf::UsesAllocatorArgT, BloombergLP::bslma::UsesBslmaAllocator< t_TYPE >::value)
 
 BSLMF_NESTED_TRAIT_DECLARATION_IF (optional, BloombergLP::bslmf::IsBitwiseMoveable, BloombergLP::bslmf::IsBitwiseMoveable< t_TYPE >::value)
 
 BSLMF_NESTED_TRAIT_DECLARATION_IF (optional, BloombergLP::bslmf::IsBitwiseCopyable, BloombergLP::bslmf::IsBitwiseCopyable< t_TYPE >::value)
 
 optional () BSLS_KEYWORD_NOEXCEPT
 
 optional (bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT
 
template<class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG>
optional(BloombergLP::bslmf::MovableRef< t_DERIVED > original, BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(t_DERIVED)) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl optional (BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG>
 optional (BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (const optional< t_ANY_TYPE > &original, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &), BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &))
 
template<class t_ANY_TYPE >
 optional (const optional< t_ANY_TYPE > &original, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &), BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &))
 
template<class t_ANY_TYPE >
 optional (BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >) original, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >) original, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class... t_ARGS>
 optional (bsl::in_place_t, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
 
 optional (bsl::allocator_arg_t, AllocType allocator)
 
 optional (bsl::allocator_arg_t, AllocType allocator, bsl::nullopt_t)
 
 optional (bsl::allocator_arg_t, AllocType allocator, const optional &original)
 
template<class t_DERIVED >
 optional (bsl::allocator_arg_t, AllocType allocator, BSLMF_MOVABLEREF_DEDUCE(t_DERIVED) original, BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(typename bsl::remove_reference< t_DERIVED >::type))
 
template<class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG>
 optional (bsl::allocator_arg_t, AllocType allocator, BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG>
 optional (bsl::allocator_arg_t, AllocType allocator, BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, const optional< t_ANY_TYPE > &original, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &), BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, const optional< t_ANY_TYPE > &original, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &), BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >) original, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >) original, BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class... t_ARGS>
 optional (bsl::allocator_arg_t, AllocType allocator, bsl::in_place_t, BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)... args)
 
optionaloperator= (bsl::nullopt_t) BSLS_KEYWORD_NOEXCEPT
 
template<class t_DERIVED >
 BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED (t_TYPE, t_DERIVED) &operator
 
template<class t_ANY_TYPE >
 BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL (t_TYPE, const t_ANY_TYPE &) &operator
 
template<class t_ANY_TYPE >
 BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL (t_TYPE, t_ANY_TYPE) &operator
 
optionaloperator= (const t_TYPE &rhs)
 
optionaloperator= (BloombergLP::bslmf::MovableRef< t_TYPE > rhs)
 
template<class t_ANY_TYPE >
 BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE (t_TYPE, t_ANY_TYPE) &operator
 
template<class t_ANY_TYPE >
 BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE (t_TYPE, t_ANY_TYPE) &operator
 
template<class t_DERIVED >
 optional (BloombergLP::bslmf::MovableRef< t_DERIVED > original, BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(t_DERIVED)) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl
 
template<class t_ANY_TYPE >
 optional (BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (const optional< t_ANY_TYPE > &original, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &), BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &))
 
template<class t_ANY_TYPE >
 optional (const optional< t_ANY_TYPE > &original, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &), BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &))
 
template<class t_ANY_TYPE >
 optional (BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >) original, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >) original, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_DERIVED >
 optional (bsl::allocator_arg_t, AllocType allocator, BSLMF_MOVABLEREF_DEDUCE(t_DERIVED) original, BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(typename bsl::remove_reference< t_DERIVED >::type))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, const optional< t_ANY_TYPE > &original, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &), BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, const optional< t_ANY_TYPE > &original, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &), BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >) original, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 
template<class t_ANY_TYPE >
 optional (bsl::allocator_arg_t, AllocType allocator, BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >) original, BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE), BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE))
 

Constructor & Destructor Documentation

◆ optional() [1/34]

template<class t_TYPE >
bsl::optional< t_TYPE >::optional ( )

Create a disengaged optional object. Use the currently installed default allocator to supply memory.

◆ optional() [2/34]

template<class t_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::nullopt_t  )

Create a disengaged optional object. Use the currently installed default allocator to supply memory.

◆ optional() [3/34]

template<class t_TYPE >
template<class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG>
optional(BloombergLP::bslmf::MovableRef< t_DERIVED > original, BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(t_DERIVED)) BSLS_KEYWORD_NOEXCEPT_SPECIFICATION(bsl bsl::optional< t_TYPE >::optional ( BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [4/34]

template<class t_TYPE >
template<class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG>
bsl::optional< t_TYPE >::optional ( BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)
explicit

Create an optional object whose contained value is initialized by forwarding from the specified value. Use the currently installed default allocator to supply memory. Note that this constructor participates in overload resolution only when t_TYPE is constructible from t_ANY_TYPE and is implicit only when t_ANY_TYPE is implicitly convertible to t_TYPE.

◆ optional() [5/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( const optional< t_ANY_TYPE > &  original,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &)  ,
BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &)   
)

◆ optional() [6/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( const optional< t_ANY_TYPE > &  original,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &)  ,
BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &)   
)
explicit

Create a disengaged optional object if the specified original object is disengaged, and an optional object with the value of original.value() converted to t_TYPE otherwise. Use the currently installed default allocator to supply memory. Note that this constructor participates in overload resolution only when t_TYPE is constructible from an lvalue of const t_ANY_TYPE, and is implicit only when an lvalue of const t_ANY_TYPE is implicitly convertible to t_TYPE.

◆ optional() [7/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >)  original,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [8/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >)  original,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)
explicit

Create a disengaged optional object if the specified original object is disengaged, and an optional object with the value of original.value() moved and converted to t_TYPE otherwise. Use the allocator from original to supply memory if t_ANY_TYPE is a non-const version of t_TYPE; otherwise, use the currently installed default allocator. original is left in a valid but unspecified state. Note that this constructor participates in overload resolution only when t_TYPE is constructible from an xvalue of t_ANY_TYPE, and is implicit only when an xvalue of t_ANY_TYPE is implicitly convertible to t_TYPE.

◆ optional() [9/34]

template<class t_TYPE >
template<class... t_ARGS>
bsl::optional< t_TYPE >::optional ( bsl::in_place_t  ,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...  args 
)
explicit

Create an optional object having the value of the (template parameter) t_TYPE created in place using the specified args. Use the currently installed default allocator to supply memory.

◆ optional() [10/34]

template<class t_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator 
)

Create a disengaged optional object. Use the specified allocator to supply memory.

◆ optional() [11/34]

template<class t_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
bsl::nullopt_t   
)

Create a disengaged optional object. Use the specified allocator to supply memory.

◆ optional() [12/34]

template<class t_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
const optional< t_TYPE > &  original 
)

If the specified original contains a value, create an optional object whose contained value is initialized from *original; otherwise, create a disengaged optional object. Use the specified allocator to supply memory.

◆ optional() [13/34]

template<class t_TYPE >
template<class t_DERIVED >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLMF_MOVABLEREF_DEDUCE(t_DERIVED)  original,
BSLSTL_OPTIONAL_DECLARE_IF_DERIVED_FROM_OPTIONAL(typename bsl::remove_reference< t_DERIVED >::type)   
)

If the optional base class of the specified original holds a value, create an optional object whose contained value is initialized by moving from that value; otherwise, create a disengaged optional object. Use the specified allocator to supply memory. original is left in a valid, but unspecified state. Note that this constructor does not participate in overload resolution unless optional is an accessible base class of t_DERIVED or t_DERIVED is optional itself (in which case the instantiation provides the allocator-extended move constructor).

◆ optional() [14/34]

template<class t_TYPE >
template<class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG>
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

Create an optional object whose contained value is initialized by forwarding from the specified value. Use the specified allocator to supply memory. Note that this constructor participates in overload resolution only when t_TYPE is constructible from t_ANY_TYPE, and is implicit only when t_ANY_TYPE is implicitly convertible to t_TYPE.

◆ optional() [15/34]

template<class t_TYPE >
template<class t_ANY_TYPE BSLSTL_OPTIONAL_DEFAULT_TEMPLATE_ARG>
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)
explicit

◆ optional() [16/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
const optional< t_ANY_TYPE > &  original,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &)  ,
BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &)   
)

Create a disengaged optional object if the specified original object is disengaged, and an optional object with the value of original.value() converted to t_TYPE otherwise. Use the specified allocator to supply memory. Note that this constructor participates in overload resolution only when t_TYPE is constructible from an lvalue of const t_ANY_TYPE, and is implicit only when an lvalue of const t_ANY_TYPE is implicitly convertible to t_TYPE.

◆ optional() [17/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
const optional< t_ANY_TYPE > &  original,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &)  ,
BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &)   
)
explicit

◆ optional() [18/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >)  original,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DECLARE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

Create a disengaged optional object if the specified original object is disengaged, and an optional object with the value of original.value() moved and converted to t_TYPE otherwise. Use the specified allocator to supply memory. original is left in a valid but unspecified state. Note that this constructor participates in overload resolution only when t_TYPE is constructible from an xvalue of t_ANY_TYPE, and is implicit only when an xvalue of t_ANY_TYPE is implicitly convertible to t_TYPE.

◆ optional() [19/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >)  original,
BSLSTL_OPTIONAL_DECLARE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DECLARE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)
explicit

◆ optional() [20/34]

template<class t_TYPE >
template<class... t_ARGS>
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
bsl::in_place_t  ,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ARGS)...  args 
)
explicit

Create an optional object having the value of the (template parameter) t_TYPE created in place using the specified args. Use the specified allocator to supply memory.

◆ optional() [21/34]

template<class t_TYPE >
template<class t_DERIVED >
bsl::optional< t_TYPE >::optional ( BloombergLP::bslmf::MovableRef< t_DERIVED >  original,
BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL(t_DERIVED)   
)

◆ optional() [22/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [23/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [24/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( const optional< t_ANY_TYPE > &  original,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &)  ,
BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &)   
)

◆ optional() [25/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( const optional< t_ANY_TYPE > &  original,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &)  ,
BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &)   
)

◆ optional() [26/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >)  original,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [27/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >)  original,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [28/34]

template<class t_TYPE >
template<class t_DERIVED >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLMF_MOVABLEREF_DEDUCE(t_DERIVED)  original,
BSLSTL_OPTIONAL_DEFINE_IF_DERIVED_FROM_OPTIONAL( typename bsl::remove_reference< t_DERIVED >::type)   
)

◆ optional() [29/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [30/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [31/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
const optional< t_ANY_TYPE > &  original,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &)  ,
BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &)   
)

◆ optional() [32/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
const optional< t_ANY_TYPE > &  original,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, const t_ANY_TYPE &)  ,
BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, const t_ANY_TYPE &)   
)

◆ optional() [33/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >)  original,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DEFINE_IF_NOT_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

◆ optional() [34/34]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::optional ( bsl::allocator_arg_t  ,
AllocType  allocator,
BSLMF_MOVABLEREF_DEDUCE(optional< t_ANY_TYPE >)  original,
BSLSTL_OPTIONAL_DEFINE_IF_CONSTRUCTS_FROM_BSL_OPTIONAL(t_TYPE, t_ANY_TYPE)  ,
BSLSTL_OPTIONAL_DEFINE_IF_EXPLICIT_CONSTRUCT(t_TYPE, t_ANY_TYPE)   
)

Member Function Documentation

◆ BSLMF_NESTED_TRAIT_DECLARATION_IF() [1/4]

template<class t_TYPE >
bsl::optional< t_TYPE >::BSLMF_NESTED_TRAIT_DECLARATION_IF ( optional< t_TYPE >  ,
BloombergLP::bslma::UsesBslmaAllocator  ,
BloombergLP::bslma::UsesBslmaAllocator< t_TYPE >::value   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION_IF() [2/4]

template<class t_TYPE >
bsl::optional< t_TYPE >::BSLMF_NESTED_TRAIT_DECLARATION_IF ( optional< t_TYPE >  ,
BloombergLP::bslmf::IsBitwiseCopyable  ,
BloombergLP::bslmf::IsBitwiseCopyable< t_TYPE >::value   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION_IF() [3/4]

template<class t_TYPE >
bsl::optional< t_TYPE >::BSLMF_NESTED_TRAIT_DECLARATION_IF ( optional< t_TYPE >  ,
BloombergLP::bslmf::IsBitwiseMoveable  ,
BloombergLP::bslmf::IsBitwiseMoveable< t_TYPE >::value   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION_IF() [4/4]

template<class t_TYPE >
bsl::optional< t_TYPE >::BSLMF_NESTED_TRAIT_DECLARATION_IF ( optional< t_TYPE >  ,
BloombergLP::bslmf::UsesAllocatorArgT  ,
BloombergLP::bslma::UsesBslmaAllocator< t_TYPE >::value   
)

◆ BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE() [1/2]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE ( t_TYPE  ,
t_ANY_TYPE   
) &

◆ BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE() [2/2]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_ANY_TYPE ( t_TYPE  ,
t_ANY_TYPE   
) &

◆ BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL() [1/2]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL ( t_TYPE  ,
const t_ANY_TYPE &   
) &

Disengage this object if the specified rhs object is disengaged, and assign to this object the value of rhs.value() (of t_ANY_TYPE) converted to t_TYPE otherwise. Return a reference providing modifiable access to this object. Note that this method does not participate in overload resolution unless t_TYPE and t_ANY_TYPE are compatible.

◆ BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL() [2/2]

template<class t_TYPE >
template<class t_ANY_TYPE >
bsl::optional< t_TYPE >::BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_BSL_OPTIONAL ( t_TYPE  ,
t_ANY_TYPE   
) &

Disengage this object if the specified rhs object is disengaged, and move assign to this object the value of rhs.value() (of t_ANY_TYPE) converted to t_TYPE otherwise. Return a reference providing modifiable access to this object. Note that this method does not participate in overload resolution unless t_TYPE and t_ANY_TYPE are compatible.

◆ BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED()

template<class t_TYPE >
template<class t_DERIVED >
bsl::optional< t_TYPE >::BSLSTL_OPTIONAL_ENABLE_ASSIGN_FROM_DERIVED ( t_TYPE  ,
t_DERIVED   
) &

◆ operator=() [1/3]

template<class t_TYPE >
optional< t_TYPE > & bsl::optional< t_TYPE >::operator= ( BloombergLP::bslmf::MovableRef< t_TYPE >  rhs)

◆ operator=() [2/3]

template<class t_TYPE >
optional< t_TYPE > & bsl::optional< t_TYPE >::operator= ( bsl::nullopt_t  )

Reset this object to be disengaged and return a reference providing modifiable access to this object.

◆ operator=() [3/3]

template<class t_TYPE >
optional< t_TYPE > & bsl::optional< t_TYPE >::operator= ( const t_TYPE &  rhs)

The documentation for this class was generated from the following file: