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. |
Déclaré dans l'en-tête <memory>
|
||
template< class T > struct allocator; |
(1) | |
template<> struct allocator<void>; |
(2) | |
Le modèle de classe
std::allocator
est le Allocator
par défaut utilisé par tous les conteneurs de la bibliothèque standard si aucun allocateur spécifié par l'utilisateur est fourni. L'allocateur par défaut est apatride, c'est-à toutes les instances de l'allocateur donnée sont interchangeables, sont égales et peut libérer la mémoire allouée par une autre instance du type d'allocation de même .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.
Spécialisation pour void n'a pas les typedefs membres
reference
, const_reference
, size_type
et difference_type
. Cette spécialisation ne déclare pas de fonctions membres .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. | (avant 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. | (depuis C++11) |
Sommaire |
[modifier] Types de membres
Type d'
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; }; |
[modifier] Fonctions membres
crée une instance allocateur new 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. (fonction membre publique) | |
Détruit une instance d'affectation 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. (fonction membre publique) | |
obtient l'adresse d'un objet, même si operator& est surcharg�� 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. (fonction membre publique) | |
alloue non initialisée stockage 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. (fonction membre publique) | |
Libère la mémoire 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. (fonction membre publique) | |
retourne la taille plus grande allocation prise en charge 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. (fonction membre publique) | |
construit un objet de stockage alloué 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. (fonction membre publique) | |
Détruit un objet de stockage alloué 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. (fonction membre publique) |
[modifier] Fonctions annexes
compare deux instances du programme d'allocation 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. (fonction membre publique) |
[modifier] Voir aussi
(C++11) |
fournit des informations sur les types d'allocateur (classe générique) |
(C++11) |
met en oeuvre plusieurs niveaux d'affectation de niveaux multiples récipients 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. (classe générique) |
(C++11) |
vérifie si le type spécifié prend en charge les utilisations-allocateur de construction 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. (classe générique) |