Constructors

Synopses

Declared in <bslstl_optional.h>

Create a disengaged Optional_Base object.

constexpr
Optional_Base();

Create a disengaged Optional_Base object.

constexpr
Optional_Base(bsl::nullopt_t nullopt);

These allocator‐extended constructors cannot be called, and are provided only to prevent compilation errors when 'optional' is explicitly instantiated.

Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator);

Create an Optional_Base object whose contained value is initialized by forwarding from the specified value.

template<class t_ANY_TYPE>
constexpr
Optional_Base(
    BloombergLP::bslstl::Optional_ConstructFromForwardRef tag,
    t_ANY_TYPE&& value);

Create an Optional_Base object.

Create an Optional_Base by copying from a std::optional.

template<class t_ANY_TYPE>
constexpr
Optional_Base(
    BloombergLP::bslstl::Optional_CopyConstructFromStdOptional tag,
    std::optional<t_ANY_TYPE> const& original);

Create an Optional_Base object.

Create an Optional_Base by moving from a std::optional.

template<class t_ANY_TYPE>
constexpr
Optional_Base(
    BloombergLP::bslstl::Optional_MoveConstructFromStdOptional tag,
    std::optional<t_ANY_TYPE>&& original);

Create an Optional_Base object whose contained value is initialized from the specified args.

template<class... t_ARGS>
constexpr
explicit
Optional_Base(
    std::in_place_t inPlace,
    t_ARGS&&... args);

Create a disengaged Optional_Base using allocator.

Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    bsl::nullopt_t nullopt);

Create an Optional_Base object, which contains the result of invocation of the specified invocable with the specified arg.

template<
    class t_INVOCABLE,
    class t_ARG>
Optional_Base(
    Optional_InvokeConstructorTag tag,
    t_INVOCABLE&& invocable,
    t_ARG&& arg);

Create an Optional_Base object whose contained value is initialized from the specified il and args.

template<
    class t_INIT_LIST_TYPE,
    class... t_ARGS>
constexpr
Optional_Base(
    std::in_place_t inPlace,
    std::initializer_list<t_INIT_LIST_TYPE> il,
    t_ARGS&&... args);

Create an Optional_Base whose value is forwarded from value.

template<class t_ANY_TYPE>
Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    BloombergLP::bslstl::Optional_ConstructFromForwardRef tag,
    t_ANY_TYPE&& value);

Create an Optional_Base by copying from another optional.

template<class t_ANY_TYPE>
Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    BloombergLP::bslstl::Optional_CopyConstructFromOtherOptional tag,
    Optional_Base<t_ANY_TYPE> const& original);

Create an Optional_Base by copying from a std::optional.

template<class t_ANY_TYPE>
Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    BloombergLP::bslstl::Optional_CopyConstructFromStdOptional tag,
    std::optional<t_ANY_TYPE> const& original);

Create an Optional_Base by moving from another optional.

template<class t_ANY_TYPE>
Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    BloombergLP::bslstl::Optional_MoveConstructFromOtherOptional tag,
    Optional_Base<t_ANY_TYPE>&& original);

Create an Optional_Base by moving from a std::optional.

template<class t_ANY_TYPE>
Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    BloombergLP::bslstl::Optional_MoveConstructFromStdOptional tag,
    std::optional<t_ANY_TYPE>&& original);

Create an Optional_Base with an in‐place constructed value.

template<class... t_ARGS>
Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    std::in_place_t inPlace,
    t_ARGS&&... args);

Create an Optional_Base with an in‐place constructed value.

template<
    class t_INIT_LIST_TYPE,
    class... t_ARGS>
Optional_Base(
    std::allocator_arg_t allocatorArg,
    AllocType allocator,
    std::in_place_t inPlace,
    std::initializer_list<t_INIT_LIST_TYPE> il,
    t_ARGS&&... args);

Parameters

Name

Description

nullopt

disengaged‐optional tag; value is unused

allocatorArg

tag selecting the allocator‐extended constructor

allocator

allocator used to supply memory

tag

tag selecting this constructor overload

value

value compared with or used to initialize the optional

original

source optional used to initialize this object

inPlace

tag selecting in‐place construction of the contained value

args

arguments forwarded to construct the contained value

invocable

callable invoked to produce the contained value

arg

argument forwarded to construct the contained value

il

initializer list forwarded to construct the contained value

Created with MrDocs