std::bad_exception

Da cppreference.com.
< cpp‎ | error

 
 
Utilità libreria
Tipo di supporto (basic types, RTTI, type traits)
Gestione della memoria dinamica
La gestione degli errori
Programma di utilità
Funzioni variadic
Data e ora
Funzione oggetti
initializer_list(C++11)
bitset
hash(C++11)
Gli operatori relazionali
Original:
Relational operators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
rel_ops::operator!=
rel_ops::operator>
rel_ops::operator<=
rel_ops::operator>=
Coppie e tuple
Original:
Pairs and tuples
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
pair
tuple(C++11)
piecewise_construct_t(C++11)
piecewise_construct(C++11)
Swap, in avanti e spostare
Original:
Swap, forward and move
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
swap
forward(C++11)
move(C++11)
move_if_noexcept(C++11)
declval(C++11)
 
La gestione degli errori
Gestione delle eccezioni
Original:
Exception handling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
exception
uncaught_exception
exception_ptr(C++11)
make_exception_ptr(C++11)
current_exception(C++11)
rethrow_exception(C++11)
nested_exception(C++11)
throw_with_nested(C++11)
rethrow_if_nested(C++11)
Gestione delle eccezioni fallimenti
Original:
Exception handling failures
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
terminate
terminate_handler
get_terminate(C++11)
set_terminate
unexpected(deprecato)
bad_exception
unexpected_handler(deprecato)
get_unexpected(C++11)(deprecato)
set_unexpected(deprecato)
Eccezione categorie
Original:
Exception categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
logic_error
invalid_argument
domain_error
length_error
out_of_range
runtime_error
range_error
overflow_error
underflow_error
Codici di errore
Original:
Error codes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Codici di errore
errno
Asserzioni
Original:
Assertions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
assert
impianto system_error
Original:
system_error facility
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
error_category(C++11)
generic_category(C++11)
system_category(C++11)
error_condition(C++11)
errc(C++11)
error_code(C++11)
system_error(C++11)
 
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.
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.
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.
cpp/error/exceptionstd-bad exception-inheritance.svg
Informazioni sull'immagine

Inheritance diagram

Indice

[modifica]Membri funzioni

costruisce l'oggetto bad_exception
Original:
constructs the bad_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)
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)[modifica]
[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]

[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
close