cpp/utility/piecewise construct: diferenças entre revisões
De cppreference.com
m uma edição: Translate from the English version |
m r2.7.3) (Robô: A adicionar: de, en, es, fr, it, ja, ru, zh |
||
| Linha 15: | Linha 15: | ||
{{dcl list template | cpp/utility/dcl list piecewise_construct_t}} | {{dcl list template | cpp/utility/dcl list piecewise_construct_t}} | ||
{{dcl list end}} | {{dcl list end}} | ||
Revisão das 19h57min de 2 de novembro de 2012
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody> constexpr piecewise_construct_t piecewise_construct = std::piecewise_construct_t(); |
(desde C++11) | |
O
std::piecewise_construct constante é uma instância de um tipo de vazio struct tag std::piecewise_construct_t.Original:
The constant
std::piecewise_construct is an instance of an empty struct tag type std::piecewise_construct_t.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Exemplo
#include <iostream>
#include <utility>
#include <tuple>
struct Foo {
Foo(std::tuple<int, float>)
{
std::cout << "Constructed a Foo from a tuple\n";
}
Foo(int, float)
{
std::cout << "Constructed a Foo from an int and a float\n";
}
};
int main()
{
std::tuple<int, float> t(1, 3.14);
std::pair<Foo, Foo> p1(t, t);
std::pair<Foo, Foo> p2(std::piecewise_construct, t, t);
}
Saída:
Constructed a Foo from a tuple
Constructed a Foo from a tuple
Constructed a Foo from an int and a float
Constructed a Foo from an int and a float