std::allocator
De cppreference.com
|
|
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. |
| Defined in header <memory>
|
||
| template< class T > struct allocator; |
(1) | |
| template<> struct allocator<void>; |
(2) | |
La plantilla de clase
std::allocator es la Allocator por defecto utilizado por todos los contenedores de la biblioteca estándar si no asignador especificado por el usuario se proporciona. El asignador predeterminado es sin estado, es decir, todas las instancias del asignador dado son intercambiables, son iguales y pueden desasignar memoria asignada por cualquier otra instancia del mismo tipo asignador .Original:
The
std::allocator class template is the default Allocator used by all standard library containers if no user-specified allocator is provided. The default allocator is stateless, that is, all instances of the given allocator are interchangeable, compare equal and can deallocate memory allocated by any other instance of the same allocator type.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.
Especialización para void carece de los miembros typedefs
reference, const_reference, size_type y difference_type. Esta especialización no declara funciones miembro .Original:
Specialization for void lacks the member typedefs
reference, const_reference, size_type and difference_type. This specialization declares no member functions.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.
| All custom allocators also must be stateless. | (hasta C + +11) |
| Custom allocators may contain state. Each container or another allocator-aware object stores an instance of the supplied allocator and controls allocator replacement through std::allocator_traits. | (ya que C + +11) |
Contenido |
[editar] Tipos de miembros
| Tipo
Original: Type The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Definition |
value_type
|
T |
pointer
|
T* |
const_pointer
|
const T* |
reference
|
T& |
const_reference
|
const T& |
size_type
|
std::size_t |
difference_type
|
std::ptrdiff_t |
rebind
|
template< class U > struct rebind { typedef allocator<U> other; }; |
[editar] Las funciones miembro
| crea una instancia de asignador de nuevo Original: creates a new allocator instance 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 función) | |
| destructs una instancia asignador Original: destructs an allocator instance 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 función) | |
| obtiene la dirección de un objeto, incluso si operator& está sobrecargado Original: obtains the address of an object, even if operator& is overloaded 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 función) | |
| asigna almacenamiento sin inicializar Original: allocates uninitialized 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 función) | |
| desasigna almacenamiento Original: deallocates 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 función) | |
| devuelve el mayor tamaño de asignación compatible Original: returns the largest supported allocation size 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 función) | |
| 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 función) | |
| destructs un objeto de almacenamiento asignado Original: destructs 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 función) | |
[editar] Terceros funciones
| Compara dos instancias asignador Original: compares two allocator instances 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 función) | |
[editar] Ver también
| (C++11) |
proporciona información sobre los tipos de asignador Original: provides information about allocator types The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (clase de plantilla) |
| (C++11) |
implementa varios niveles asignador de niveles múltiples recipientes Original: implements multi-level allocator for multi-level containers The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (clase de plantilla) |
| (C++11) |
comprueba si el tipo especificado admite usos-asignador de construcción Original: checks if the specified type supports uses-allocator construction The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (clase de plantilla) |