std::bad_exception
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 <exception> | ||
class bad_exception; | ||
std::bad_exception
è il tipo di eccezione generata dal runtime C + + nei seguenti casi:Original:
std::bad_exception
is the type of the exception thrown by the C++ runtime in the following situations: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.
1)
Se un eccezione specificazione dinamica viene violata e std::unexpected lancia o genera nuovamente un'eccezione che viola ancora la specifica eccezione, ma la specifica eccezione consente
std::bad_exception
, std::bad_exception
viene gettato.Original:
If a eccezione specificazione dinamica is violated and std::unexpected throws or rethrows an exception that still violates the exception specification, but the exception specification allows
std::bad_exception
, std::bad_exception
is thrown.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.
2)
Se std::exception_ptr memorizza una copia della deroga catturato e se il costruttore di copia dell'oggetto eccezione catturato da current_exception genera un'eccezione, l'eccezione catturata è un'istanza di
std::bad_exception
.Original:
If std::exception_ptr stores a copy of the caught exception and if the copy constructor of the exception object caught by current_exception throws an exception, the captured exception is an instance of
std::bad_exception
.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]Membri funzioni
costruisce l'oggetto bad_exception Original: constructs the bad_exception objectThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (metodo pubblico) | |
copia l'oggetto Original: copies the 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] | restituisce la stringa esplicativa Original: returns the 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) |
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 <exception>#include <stdexcept> void my_unexp(){throw;} void test()throw(std::bad_exception){throwstd::runtime_error("test");} int main(){std::set_unexpected(my_unexp);try{ test();}catch(const std::bad_exception& e){std::cerr<<"Caught "<< e.what()<<'\n';}}
Output:
Caught std::bad_exception