std::bad_alloc
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. |
Elemento definito nell'header <new> | ||
class bad_alloc; | ||
std::bad_alloc
is the type of the object thrown as exceptions by the <div class="t-tr-text">allocazione funzioni</div> to report failure to allocate storage. Original:allocation functionsThe text has been machine-translated via [http://translate.google.com Google Translate].
You can help to correct and verify the translation. Click [http://en.cppreference.com/w/Cppreference:MachineTranslations here] for instructions.
Indice |
[modifica]Membri funzioni
constructs the bad_alloc object (metodo pubblico) | |
replaces a bad_alloc object (metodo pubblico) | |
restituisce stringa esplicativa Original: returns explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) |
Inherited from std::exception
Member functions
[virtuale] | distrugge l'oggetto eccezione Original: destructs the exception object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico virtuale) |
[virtuale] | restituisce una stringa esplicativa Original: returns an explanatory string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico virtuale) |
[modifica]Esempio
#include <iostream>#include <new> int main(){try{while(true){ new int[100000000ul];}}catch(const std::bad_alloc& e){std::cout<<"Allocation failed: "<< e.what()<<'\n';}}
Output:
Allocation failed: std::bad_alloc
[modifica]Vedi anche
allocazione funzioni Original: allocation functions The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (funzione) |