_t ` assume that each
tuple argument becomes the element of a pair. The overloads that use `
std::piecewise_construct_t ` assume that each tuple argument is used to
construct, piecewise, a new object of specified type, which will become the
element of the pair.

###  [ [ edit
](/mwiki/index.php?title=cpp/utility/piecewise_construct&action=edit&section=1
"Edit section: Example") ]  Example

[ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/utility/example_piecewise_construct&action=edit)

Run this code

    
    
    #include <iostream>
    #include <tuple>
    #include <utility>
     
    struct Foo
    {
        Foo([std::tuple](http://en.cppreference.com/w/cpp/utility/tuple)<int, float>)
        {
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "Constructed a Foo from a tuple\n";
        }
     
        Foo(int, float)
        {
            [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "Constructed a Foo from an int and a float\n";
        }
    };
     
    int main()
    {
        [std::tuple](http://en.cppreference.com/w/cpp/utility/tuple)<int, float> t(1, 3.14);
     
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "Creating p1...\n";
        [std::pair](http://en.cppreference.com/w/cpp/utility/pair)<Foo, Foo> p1(t, t);
     
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << "Creating p2...\n";
        [std::pair](http://en.cppreference.com/w/cpp/utility/pair)<Foo, Foo> p2(std::piecewise_construct, t, t);
    }

Output:

    
    
    Creating p1...
    Constructed a Foo from a tuple
    Constructed a Foo from a tuple
    Creating p2...
    Constructed a Foo from an int and a float
    Constructed a Foo from an int and a float

###  [ [ edit
](/mwiki/index.php?title=cpp/utility/piecewise_construct&action=edit&section=2
"Edit section: Defect reports") ]  Defect reports

The following behavior-changing defect reports were applied retroactively to
previously published C++ standards.

DR  |  Applied to  |  Behavior as published  |  Correct behavior   
---|---|---|---  
[ LWG 2510 ](https://cplusplus.github.io/LWG/issue2510) |  C++11  |  the default constructor was non-explicit, which could lead to ambiguity  |  made explicit   
  
###  [ [ edit
](/mwiki/index.php?title=cpp/utility/piecewise_construct&action=edit&section=3
"Edit section: See also") ]  See also

[ (constructor)  ](/w/cpp/utility/pair/pair "cpp/utility/pair/pair") |  constructs new pair   
(public member function of ` std::pair<T1,T2> ` )  
---|---  
  
Retrieved from " [
https://en.cppreference.com/mwiki/index.php?title=cpp/utility/piecewise_construct&oldid=164086
](https://en.cppreference.com/mwiki/index.php?title=cpp/utility/piecewise_construct&oldid=164086)
"

#####  Navigation

  * [ Support us ](http://www.cppreference.com/support)
  * [ Recent changes ](/w/Special:RecentChanges "A list of recent changes in the wiki \[r\]")
  * [ FAQ ](/w/Cppreference:FAQ)
  * [ Offline version ](/w/Cppreference:Archives)

#####  Toolbox

  * [ What links here ](/w/Special:WhatLinksHere/cpp/utility/piecewise_construct "A list of all wiki pages that link here \[j\]")
  * [ Related changes ](/w/Special:RecentChangesLinked/cpp/utility/piecewise_construct "Recent changes in pages linked from this page \[k\]")
  * [ Upload file ](http://upload.cppreference.com/w/Special:Upload "Upload files \[u\]")
  * [ Special pages ](/w/Special:SpecialPages "A list of all special pages \[q\]")
  * [ Printable version ](/mwiki/index.php?title=cpp/utility/piecewise_construct&printable=yes "Printable version of this page \[p\]")
  * [ Permanent link ](/mwiki/index.php?title=cpp/utility/piecewise_construct&oldid=164086 "Permanent link to this revision of the page")
  * [ Page information ](/mwiki/index.php?title=cpp/utility/piecewise_construct&action=info)

  * In other languages 

  * [ Deutsch ](http://de.cppreference.com/w/cpp/utility/piecewise_construct "cpp/utility/piecewise construct")
  * [ Español ](