bsl::pair::pair

Constructors

Synopses

Declared in <bslstl_pair.h>

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

constexpr
pair() = default;
» more...

Construct a pair from the specified other pair, holding first and second values of (template parameter) type PARAM_1 and PARAM_2 respectively.

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);
» more...

Construct a pair from the specified other rvalue pair, holding first and second values of (template parameter) type PARAM_1 and PARAM_2 respectively. This method requires that T1 and T2 be convertible from PARAM_1 and PARAM_2, respectively.

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);
» more...

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);
» more...

Create a pair that has the same value as the specified rhs pair proxy. The behavior is undefined unless T1 is constructible from PARAM_1 and T2 is constructible from from PARAM_2.

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

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);
» more...

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);
» more...

Construct a pair with the first member initialized to the specified a value and the second member initialized to the specified b value. Optionally specify a basicAllocator, used to supply memory for each of first and second when its type (template parameter T1 or T2, respectively) uses bslma-style allocators. This method requires that T1 and T2 be copy-constructible.

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

Construct a pair having the same value as that of the specified original pair. Optionally specify a basicAllocator, used to supply memory for each of first and second when its type (template parameter T1 or T2, respectively) uses bslma-style allocators. Note that the copy constructor is implicitly declared (if T1 and T2 are both copy-constructible) by compilers that do not support defaulted declarations.

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

Construct a pair having the same value as that of the specified original using the specified basicAllocator to supply memory for each of first and second when its type (template parameter T1 or T2, respectively) uses bslma-style allocators. Note that original is left in a valid but unspecified state. Also note that this method requires that T1 and T2 be move-constructible. Note this this constructor will not be deleted when the implicitly declared move constructor is deleted, and will produce an error when it is called in such cases.

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

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

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

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

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

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);
» more...

Construct a pair from the specified other rvalue pair, using the specified basicAllocator to supply memory for each member when its type uses bslma-style allocators.

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

Construct a pair with the first member initialized to the specified a value and the second member initialized to the specified b value.

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);
» more...

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);
» more...

Create a pair from piece-wise construction of first and second values by forwarding in order the elements in the specified first_args and second_args tuples to the corresponding constructor of (template parameter) types T1 and T2, respectively. Optionally specify a basicAllocator, used to supply memory for each of first and second when its type (template parameter T1 or T2, respectively) uses bslma-style allocators. Allocators can also be passed as tuple members straight to T1 or T2 (or both) constructors using the first version (but use of the second version for this approach will result in a compile-time error). This method requires that T1 and T2 be constructible from (the variable number of template parameters) ARGS_1 and ARGS_2 respectively.

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

Construct a pair with the first member initialized to the specified a value and the second member initialized to the specified b value, using the specified basicAllocator to supply memory for each member when its type uses bslma-style allocators.

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

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

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