Constructors

Synopses

Declared in <bslstl_pair.h>

Construct a pair with the first and second members initialized to default values.

constexpr
pair() = default;

Construct a pair from the specified other pair.

template<
    class PARAM_1,
    class PARAM_2,
    class = void>
requires std::is_constructible<T1, const PARAM_1&>::value &&
                            std::is_constructible<T2, const PARAM_2&>::value
constexpr
pair(pair<PARAM_1, PARAM_2> const& other);

Construct a pair from the specified other rvalue pair.

template<
    class PARAM_1,
    class PARAM_2,
    class = void>
requires bsl::is_convertible<PARAM_1, T1>::value
                                    && bsl::is_convertible<PARAM_2, T2>::value
constexpr
pair(pair<PARAM_1, PARAM_2>&& other);

Construct a default pair, using the specified basicAllocator to supply memory for each member when its type uses bslma‐style allocators.

explicit
pair(BloombergLP::bslma::Allocator* basicAllocator);

Create a pair having the same value as the specified rhs pair proxy.

template<
    class PARAM_1,
    class PARAM_2>
constexpr
pair(BloombergLP::bslma::ManagedPtr_PairProxy<PARAM_1, PARAM_2> const& rhs);

Same as the preceding overload.

template<
    class PARAM_1,
    class PARAM_2,
    class = void>
requires std::is_constructible<T1, const PARAM_1&>::value &&
                            std::is_constructible<T2, const PARAM_2&>::value
constexpr
pair(std::pair<PARAM_1, PARAM_2> const& other);

Same as the constructor taking pair<PARAM_1, PARAM_2>&&.

template<
    class PARAM_1,
    class PARAM_2,
    class = void>
requires bsl::is_convertible<PARAM_1, T1>::value
                                    && bsl::is_convertible<PARAM_2, T2>::value
constexpr
pair(std::pair<PARAM_1, PARAM_2>&& other);

Construct a pair from the specified a and b values.

constexpr
pair(
    bsl::add_lvalue_reference<T1 const>::type a,
    bsl::add_lvalue_reference<T2 const>::type b);

Copy original using basicAllocator to supply memory.

pair(
    pair const& original,
    BloombergLP::bslma::Allocator* basicAllocator);

Move original using basicAllocator to supply memory.

pair(
    pair&& original,
    BloombergLP::bslma::Allocator* basicAllocator);

Construct a pair from other, using basicAllocator.

template<
    class PARAM_1,
    class PARAM_2>
pair(
    pair<PARAM_1, PARAM_2> const& other,
    BloombergLP::bslma::Allocator* basicAllocator);

Construct a pair from the std::pair other, using basicAllocator.

template<
    class PARAM_1,
    class PARAM_2>
pair(
    std::pair<PARAM_1, PARAM_2> const& other,
    BloombergLP::bslma::Allocator* basicAllocator);

Construct a pair from the specified rvalue other pair.

template<
    class PARAM_1,
    class PARAM_2>
pair(
    pair<PARAM_1, PARAM_2>&& other,
    BloombergLP::bslma::Allocator* basicAllocator);

Construct a pair from the rvalue other, using basicAllocator.

template<
    class PARAM_1,
    class PARAM_2>
pair(
    std::pair<PARAM_1, PARAM_2>&& other,
    BloombergLP::bslma::Allocator* basicAllocator);

Construct a pair from the specified a and b values.

template<
    class PARAM_1,
    class PARAM_2,
    class = void>
requires std::is_constructible<T1, PARAM_1>::value &&
                std::is_constructible<T2, PARAM_2>::value &&
                !(bsl::is_pointer<bsl::remove_reference_t<PARAM_2>>::value &&
                  bsl::is_convertible<PARAM_2,
                                      BloombergLP::bslma::Allocator *>::value)
constexpr
pair(
    PARAM_1&& a,
    PARAM_2&& b);

Create a pair from the specified a and b lvalue references.

pair(
    bsl::add_lvalue_reference<T1 const>::type a,
    bsl::add_lvalue_reference<T2 const>::type b,
    BloombergLP::bslma::Allocator* basicAllocator);

Construct first and second piece‐wise from tuples of arguments.

template<
    class... ARGS_1,
    class... ARGS_2>
pair(
    std::piecewise_construct_t tag,
    std::tuple<ARGS_1...> first_args,
    std::tuple<ARGS_2...> second_args);

Construct a pair from a and b, using basicAllocator.

template<
    class PARAM_1,
    class PARAM_2>
pair(
    PARAM_1&& a,
    PARAM_2&& b,
    BloombergLP::bslma::Allocator* basicAllocator);

Same as the preceding constructor, using the specified basicAllocator to supply memory.

template<
    class... ARGS_1,
    class... ARGS_2>
pair(
    std::piecewise_construct_t tag,
    std::tuple<ARGS_1...> first_args,
    std::tuple<ARGS_2...> second_args,
    BloombergLP::bslma::Allocator* basicAllocator);

Parameters

Name

Description

other

pair whose members initialize this pair's members

basicAllocator

allocator used to supply memory

rhs

pair proxy whose members initialize this pair's members

a

value copied into the first member

b

value copied into the second member

original

pair whose value is copied

tag

tag selecting piece‐wise construction

first_args

tuple of arguments forwarded to the constructor of T1

second_args

tuple of arguments forwarded to the constructor of T2

Created with MrDocs