std::allocator::allocate
Da cppreference.com.
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
pointer allocate( size_type n, std::allocator<void>::const_pointer hint = 0 ); |
||
Assegna n * sizeof(T) byte di memoria non inizializzata chiamando ::operator new(std::size_t), ma è specificato quando e come questa funzione viene chiamata. Il
hint
puntatore può essere usato per fornire frazione di riferimento: l'allocatore, se supportato dall'implementazione, tenterà di allocare il nuovo blocco di memoria più vicino possibile al hint
.Original:
Allocates n * sizeof(T) bytes of uninitialized storage by calling ::operator new(std::size_t), but it is unspecified when and how this function is called. The pointer
hint
may be used to provide locality of reference: the allocator, if supported by the implementation, will attempt to allocate the new memory block as close as possible to hint
.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.
Indice |
[modifica] Parametri
n | - | il numero di oggetti da allocare memoria per
Original: the number of objects to allocate storage for The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
hint | - | puntatore a una posizione di memoria nelle vicinanze
Original: pointer to a nearby memory location The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica] Valore di ritorno
Puntatore al primo byte di un blocco di memoria opportunamente allineati e sufficiente per contenere un array di oggetti di
n
T
tipo.Original:
Pointer to the first byte of a memory block suitably aligned and sufficient to hold an array of
n
objects of type T
.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.
[modifica] Eccezioni
Genera std::bad_alloc se allocazione non riesce.
Original:
Throws std::bad_alloc if allocation fails.
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.
[modifica] Vedi anche
[statico] |
alloca memoria non inizializzata utilizzando l'allocatore Original: allocates uninitialized storage using the allocator The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico statico) |