Espacios de nombres
Variantes
Acciones

std::scoped_allocator_adaptor::construct

De cppreference.com

 
 
Gestión de memoria dinámica
Bajo la gestión de memoria de nivel
Los asignadores
Original:
Allocators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
allocator
allocator_traits(C++11)
allocator_arg_t(C++11)
allocator_arg(C++11)
uses_allocator(C++11)
scoped_allocator_adaptor(C++11)
Inicializar el almacenamiento
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.
uninitialized_copy
uninitialized_copy_n(C++11)
uninitialized_fill
uninitialized_fill_n
raw_storage_iterator
get_temporary_buffer
return_temporary_buffer
Punteros 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.
unique_ptr(C++11)
shared_ptr(C++11)
weak_ptr(C++11)
auto_ptr(obsoleto)
owner_less(C++11)
enable_shared_from_this(C++11)
bad_weak_ptr(C++11)
default_delete(C++11)
Garbage soporte colección
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.
declare_reachable(C++11)
undeclare_reachable(C++11)
declare_no_pointers(C++11)
undeclare_no_pointers(C++11)
pointer_safety(C++11)
get_pointer_safety(C++11)
Varios
Original:
Miscellaneous
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pointer_traits(C++11)
addressof(C++11)
align(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
Las funciones miembro
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
Terceros funciones
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.
operator==
operator!=
 
Defined in header <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, const std::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)
Construye un objeto asignado, pero no inicializado almacenamiento apuntado por p utilizando OuterAllocator y los argumentos del constructor previstas. Si el objeto es del tipo que se utiliza asignador, o si es std :: pair, pasa InnerAllocator hasta el objeto construido .
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.
En primer lugar, determina el tipo asignador más exterior OUTERMOST: es el tipo que se devuelve llamando this->outer_allocator(), y entonces llama a la función miembro outer_allocator() recursivamente en el resultado de esta llamada hasta alcanzar el tipo que no tiene ninguna función de dicho miembro. Ese tipo es el asignador de extremo .
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.
A continuación:
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)
Si std::uses_allocator<T, inner_allocator_type>::value==false (el T tipo no utiliza asignadores) y si std::is_constructible<T, Args...>::value==true, luego llama
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)... );

De lo contrario, si std::uses_allocator<T, inner_allocator_type>::value==true (la T tipo utiliza asignador, por ejemplo, es un recipiente) y si std::is_constructible<T, std::allocator_arg_t, inner_allocator_type, Args...>::value==true, a continuación, llama
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)... );

De lo contrario, std::uses_allocator<T, inner_allocator_type>::value==true (la T tipo utiliza asignador, por ejemplo, es un recipiente) y si std::is_constructible<T, Args..., inner_allocator_type>::value==true, a continuación, llama
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());

De lo contrario, el error de compilación se genera porque aunque std::uses_allocator<T> afirmó que T es asignador-aware, que carece de cualquier forma de asignador aceptores de constructores .
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)
En primer lugar, si bien T1 o T2 es asignador-consciente, modifica las tuplas x y y para incluir el asignador interior apropiado, resultando en las dos nuevas tuplas xprime y yprime, de acuerdo con las tres reglas siguientes:
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) si no es T1 asignador-aware (std::uses_allocator<T1, inner_allocator_type>::value==false, entonces xprime es x, sin modificar. (También se requiere 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) si es T1 asignador-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), y su constructor toma una etiqueta asignador ( std::is_constructible<T1, std::allocator_arg_t, inner_allocator_type, Args1...>::value==true, entonces es 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) si es T1 asignador-aware (std::uses_allocator<T1, inner_allocator_type>::value==true), y su constructor toma el asignador como último argumento (std::is_constructible<T1, Args1..., inner_allocator_type>::value==true), entonces es xprime std::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.
Las mismas reglas se aplican a T2 y la sustitución de y con 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.
Una vez xprime y yprime están construidos (esto también requiere que todos los tipos de Args1 ... y Args2 ... son CopyConstructible), construye el p par de almacenamiento asignado por vocación
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<>()), es decir, pasa el asignador de interior a los tipos de miembro de la pareja si son aceptados .
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)))

Contenido

[editar] Parámetros

p -
puntero a asignado, pero no inicializado almacenamiento
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... -
el constructor de argumentos que se pasan al constructor 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 -
el constructor de argumentos que se pasan al constructor 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 -
el constructor de argumentos que se pasan al constructor 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 -
la pareja cuyos dos miembros son los argumentos del constructor para T1 y 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

(Ninguno)
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 función es llamada (a través de std::allocator_traits) por cualquier objeto asignador-conscientes, tales como std::vector, que se le dio un std::scoped_allocator_adaptor como el asignador de usar. Desde inner_allocator sí mismo es un ejemplo de std::scoped_allocator_adaptor, esta función también se llama cuando los objetos conscientes asignador construidas a través de esta función iniciar la construcción de sus propios miembros .
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] Ver también

[estático]
construye un objeto en el almacenamiento asignado
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.

(función de plantilla) [edit]
construye un objeto de almacenamiento asignado
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.

(miembro público of std::allocator función) [edit]