Espaços nominais
Variantes
Acções

std::scoped_allocator_adaptor::construct

Da cppreference.com

 
 
Gerenciamento de memória dinâmica
Gerenciamento de memória de baixo nível
Alocadores
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uninitialized armazenamento
Original:
Uninitialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Ponteiros inteligentes
Original:
Smart pointers
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
(C++11)
(obsoleta)
(C++11)
Apoio a coleta de lixo
Original:
Garbage collection support
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Diversos
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
(C++11)
(C++11)
C Library
Original:
C Library
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
std::scoped_allocator_adaptor
Funções de membro
Original:
Member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
scoped_allocator_adaptor::scoped_allocator_adaptor
scoped_allocator_adaptor::~scoped_allocator_adaptor
scoped_allocator_adaptor::inner_allocator
scoped_allocator_adaptor::outer_allocator
scoped_allocator_adaptor::allocate
scoped_allocator_adaptor::deallocate
scoped_allocator_adaptor::max_size
scoped_allocator_adaptor::construct
scoped_allocator_adaptor::destroy
scoped_allocator_adaptor::select_on_container_copy_construction
Não-membros funções
Original:
Non-member functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
 
Definido no cabeçalho <scoped_allocator>
template<class T, class... Args>
void construct( T* p, Args&&... args)
(1)
template<class T1, class T2, class... Args1, class... Args2>

void construct(std::pair<T1, T2>* p,
                std::piecewise_construct_t,
                std::tuple<Args1...> x,

                std::tuple<Args2...> y )
(2)
template<class T1, class T2 >
void construct(std::pair<T1, T2>* p )
(3)
template<class T1, class T2, class U, class V >
void construct(std::pair<T1, T2>* p, U&& x, V&& y )
(4)
template<class T1, class T2, class U, class V >
void construct(std::pair<T1, T2>* p, conststd::pair<U, V>& xy )
(5)
template<class T1, class T2, class U, class V >
void construct(std::pair<T1, T2>* p, std::pair<U, V>&& xy );
(6)
Constrói um objeto em alocado, mas não inicializado armazenamento apontado por p usando OuterAllocator e os argumentos do construtor prestados. Se o objeto é do tipo que se usa alocadores, ou se é std :: pair, passa InnerAllocator até o objeto construído.
Original:
Constructs an object in allocated, but not initialized storage pointed to by p using OuterAllocator and the provided constructor arguments. If the object is of type that itself uses allocators, or if it is std::pair, passes InnerAllocator down to the constructed object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Primeiro, determina o tipo de alocação externa OUTERMOST: é o tipo que seria devolvido chamando this->outer_allocator(), e em seguida, chamar a função membro outer_allocator() recursivamente sobre o resultado dessa chamada até atingir o tipo que não tem função de membro de tal. Esse tipo é o alocador externa.
Original:
First, determines the outermost allocator type OUTERMOST: it is the type that would be returned by calling this->outer_allocator(), and then calling the outer_allocator() member function recursively on the result of this call until reaching the type that has no such member function. That type is the outermost allocator.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Então:
Original:
Then:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
1)
Se std::uses_allocator<T, inner_allocator_type>::value==false (o T tipo não use alocadores) e se std::is_constructible<T, Args...>::value==true, então chama
Original:
If std::uses_allocator<T, inner_allocator_type>::value==false (the type T does not use allocators) and if std::is_constructible<T, Args...>::value==true, then calls
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::allocator_traits<OUTERMOST>::construct( OUTERMOST(*this),
                                             p,
                                             std::forward<Args>(args)... );

Caso contrário, se std::uses_allocator<T, inner_allocator_type>::value==true (o T tipo usa alocadores, por exemplo, é um recipiente) e se std::is_constructible<T, std::allocator_arg_t, inner_allocator_type, Args...>::value==true, então chama
Original:
Otherwise, if std::uses_allocator<T, inner_allocator_type>::value==true (the type T uses allocators, e.g. it is a container) and if std::is_constructible<T, std::allocator_arg_t, inner_allocator_type, Args...>::value==true, then calls
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::allocator_traits<OUTERMOST>::construct( OUTERMOST(*this),
                                             p,
                                             std::allocator_arg,
                                             inner_allocator(),
                                             std::forward<Args>(args)... );

Caso contrário, std::uses_allocator<T, inner_allocator_type>::value==true (o T tipo usa alocadores, por exemplo, é um recipiente) e se std::is_constructible<T, Args..., inner_allocator_type>::value==true, então chama
Original:
Otherwise, std::uses_allocator<T, inner_allocator_type>::value==true (the type T uses allocators, e.g. it is a container) and if std::is_constructible<T, Args..., inner_allocator_type>::value==true, then calls
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::allocator_traits<OUTERMOST>::construct( OUTERMOST(*this),
                                             p,
                                             std::forward<Args>(args)...,
                                             inner_allocator());

Caso contrário, erro de compilação é emitido porque embora std::uses_allocator<T> afirmou que T é alocador-consciente, que carece de qualquer forma de alocador de aceitação de construtores.
Original:
Otherwise, compilation error is issued because although std::uses_allocator<T> claimed that T is allocator-aware, it lacks either form of allocator-accepting constructors.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
Em primeiro lugar, se um ou outro ou T1T2 é alocador-ciente, modifica os tuplos x e y para incluir o alocador apropriado interior, resultando em dois tuplos novos xprimeyprime e, de acordo com as seguintes três regras:
Original:
First, if either T1 or T2 is allocator-aware, modifies the tuples x and y to include the appropriate inner allocator, resulting in the two new tuples xprime and yprime, according to the following three rules:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2a) se T1 não é alocador-aware (std::uses_allocator<T1, inner_allocator_type>::value==false, então xprime é x, sem modificações. (Também é necessário que std::is_constructible<T1, Args1...>::value==true)
Original:
2a) if T1 is not allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==false, then xprime is x, unmodified. (it is also required that std::is_constructible<T1, Args1...>::value==true)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2b.) Se T1 é alocador-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), e seu construtor tem uma tag alocador ( std::is_constructible<T1, std::allocator_arg_t, inner_allocator_type, Args1...>::value==true, então é xprime
Original:
2b) if T1 is allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), and its constructor takes an allocator tag (std::is_constructible<T1, std::allocator_arg_t, inner_allocator_type, Args1...>::value==true, then xprime is
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::tuple_cat(std::tuple<std::allocator_arg_t, inner_allocator_type&>(std::allocator_arg,
                                                                               inner_allocator_type()
                                                                              ), x)

2c) se T1 é alocador-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), e seu construtor tem o alocador como último argumento (std::is_constructible<T1, Args1..., inner_allocator_type>::value==true), então é xprimestd::tuple_cat(x, std::tuple<inner_allocator_type&>(inner_allocator_type())).
Original:
2c) if T1 is allocator-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), and its constructor takes the allocator as the last argument (std::is_constructible<T1, Args1..., inner_allocator_type>::value==true), then xprime is std::tuple_cat(x, std::tuple<inner_allocator_type&>(inner_allocator_type())).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
As mesmas regras se aplicam a T2 ea substituição de y com yprime
Original:
Same rules apply to T2 and the replacement of y with yprime
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uma vez xprime e yprime são construídos (isto também requer que todos os tipos de Args1... e Args2... são CopyConstructible), constrói a p par de armazenamento alocado chamando
Original:
Once xprime and yprime are constructed (this also requires that all types in Args1... and Args2... are CopyConstructible), constructs the pair p in allocated storage by calling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

std::allocator_traits<OUTERMOST>::construct( OUTERMOST(*this),
                                             p,
                                             std::piecewise_construct,
                                             xprime,
                                             yprime);


3)
Equivalente a construct(p, std::piecewise_construct, std::tuple<>(), std::tuple<>()), isto é, passa o alocador interior para tipos do par membros no caso de aceitá-los.
Original:
Equivalent to construct(p, std::piecewise_construct, std::tuple<>(), std::tuple<>()), that is, passes the inner allocator on to the pair's member types if they accept them.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
Equivalente a
Original:
Equivalent to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

    construct(p, std::piecewise_construct, std::forward_as_tuple(std::forward<U>(x)),
                                           std::forward_as_tuple(std::forward<V>(y)))

5)
Equivalente a
Original:
Equivalent to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

    construct(p, std::piecewise_construct, std::forward_as_tuple(xy.first),
                                           std::forward_as_tuple(xy.second))

6)
Equivalente a
Original:
Equivalent to
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

    construct(p, std::piecewise_construct, std::forward_as_tuple(std::forward<U>(xy.first)),
                                           std::forward_as_tuple(std::forward<V>(xy.second)))

Índice

[editar]Parâmetros

p -
ponteiro para alocada, mas não inicializada armazenamento
Original:
pointer to allocated, but not initialized storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
args... -
o construtor argumentos para passar para o construtor de T
Original:
the constructor arguments to pass to the constructor of T
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
x -
o construtor argumentos para passar para o construtor de T1
Original:
the constructor arguments to pass to the constructor of T1
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
y -
o construtor argumentos para passar para o construtor de T2
Original:
the constructor arguments to pass to the constructor of T2
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
xy -
o par cujos membros são dois os argumentos do construtor para T1 e T2
Original:
the pair whose two members are the constructor arguments for T1 and T2
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Valor de retorno

(Nenhum)
Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Notas

Esta função é chamada (através std::allocator_traits) por qualquer objeto alocador-ciente, como std::vector, que foi dada uma std::scoped_allocator_adaptor como o alocador de usar. Desde inner_allocator é por si só uma instância de std::scoped_allocator_adaptor, esta função também será chamado quando os objetos alocador-aware construídos através desta função começar a construir seus próprios membros.
Original:
This function is called (through std::allocator_traits) by any allocator-aware object, such as std::vector, that was given a std::scoped_allocator_adaptor as the allocator to use. Since inner_allocator is itself an instance of std::scoped_allocator_adaptor, this function will also be called when the allocator-aware objects constructed through this function start constructing their own members.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Veja também

[estática]
constrói um objeto no armazenamento alocado
Original:
constructs an object in the allocated storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de função)[edit]
constrói um objeto no armazenamento alocado
Original:
constructs an object in allocated storage
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(of std::allocator função pública membro)[edit]
close