std::allocator
Материал из 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. |
| Заголовочный файл <memory>
|
||
| template< class T > struct allocator; |
(1) | |
| template<> struct allocator<void>; |
(2) | |
Шаблон
std::allocator класса по умолчанию Allocator используется всеми стандартными контейнерами библиотеки, если не указанное пользователем распределителя обеспечивается. По умолчанию распределитель является лицом без гражданства, то есть, все экземпляры данного распределителя являются взаимозаменяемыми, сравнить равные и может освободить память, выделенную любой другой экземпляр того же типа распределителя.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.
Специализация для void не хватает члена ЬурейеЕ
reference, const_reference, size_type и difference_type. Эта специализация не объявляет функций-членов.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. | (до 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. | (начиная с C++11) |
Содержание |
[править] Член типов
| Type
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; }; |
[править] Член функций
| создает новый экземпляр распределителя 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. (public функция-член) | |
| разрушает распределитель экземпляр 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. (public функция-член) | |
| получает адрес объекта, даже если operator& перегружен 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. (public функция-член) | |
| выделяет неинициализированные хранения 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. (public функция-член) | |
| освобождает хранения 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. (public функция-член) | |
| возвращает наибольшее поддерживаемый размер ассигнований 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. (public функция-член) | |
| создает объект выделено в хранении 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. (public функция-член) | |
| разрушает объект выделено хранения 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. (public функция-член) | |
[править] Не являющиеся членами функций
| Сравнивает два экземпляра распределителя 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. (public функция-член) | |
[править] См. также
| (C++11) |
предоставляет информацию о распределитель типа 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. (шаблон класса) |
| (C++11) |
реализует многоуровневую распределитель для многоуровневых контейнеров 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. (шаблон класса) |
| (C++11) |
проверяет, является ли указанный тип поддерживает использование-распределитель строительства 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. (шаблон класса) |