Namespaces
Variants

std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>:: allocate

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
Défini dans l'en-tête <scoped_allocator>
pointer allocate ( size_type n ) ;
(1) (depuis C++11)
pointer allocate ( size_type n, const_void_pointer hint ) ;
(2) (depuis C++11)

Utilise l'allocateur externe pour allouer un stockage non initialisé.

1) Appelle std:: allocator_traits < OuterAlloc > :: allocate ( outer_allocator ( ) , n ) .
2) Fournit en outre un indice de localité mémoire, en appelant std:: allocator_traits < OuterAlloc > :: allocate ( outer_allocator ( ) , n, hint ) .

Paramètres

n - le nombre d'objets pour lesquels allouer de la mémoire
hint - pointeur vers un emplacement mémoire proche

Valeur de retour

Le pointeur vers le stockage alloué.

Voir aussi

alloue de la mémoire non initialisée
(fonction membre publique de std::allocator<T> )
[static]
alloue de la mémoire non initialisée en utilisant l'allocateur
(fonction membre publique statique de std::allocator_traits<Alloc> )