[#bsl-pair-0b-2constructor-096]
= xref:bsl.adoc[bsl]::xref:bsl/pair-0b.adoc[pair]::pair
:relfileprefix: ../../
:mrdocs:

Construct `first` and `second` piece&hyphen;wise from tuples of arguments&period;

== Synopsis

Declared in `&lt;bslstl&lowbar;pair&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class&period;&period;&period; ARGS&lowbar;1,
    class&period;&period;&period; ARGS&lowbar;2&gt;
pair(
    std::piecewise&lowbar;construct&lowbar;t tag,
    std::tuple&lt;ARGS&lowbar;1&period;&period;&period;&gt; first&lowbar;args,
    std::tuple&lt;ARGS&lowbar;2&period;&period;&period;&gt; second&lowbar;args);
----

== Description

Create a `pair` from piece&hyphen;wise construction of `first` and `second` values by forwarding in order the elements in the specified `first&lowbar;args` and `second&lowbar;args` tuples to the corresponding constructor of (template parameter) types `T1` and `T2`, respectively&period; 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`&hyphen;style allocators&period; 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&hyphen;time error)&period; This method requires that `T1` and `T2` be constructible from (the variable number of template parameters) `ARGS&lowbar;1` and `ARGS&lowbar;2` respectively&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *tag*
| tag selecting piece&hyphen;wise construction
| *first&lowbar;args*
| tuple of arguments forwarded to the constructor of `T1`
| *second&lowbar;args*
| tuple of arguments forwarded to the constructor of `T2`
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
