std::bad_exception - cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Definido no cabeçalho <exception> |
||
|
|
||
std::bad_exception é o tipo da exceção lançada pelo tempo de execução C + + nas seguintes situações:
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 um especificação excepção dinâmico é violada e std::unexpected lança ou relança uma exceção que ainda viola a especificação de exceção, mas a especificação de exceção permite std::bad_exception, std::bad_exception é jogado.
Original:
If a especificação excepção dinâmico 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 armazena uma cópia da exceção capturada e se o construtor de cópia do objeto de exceção pego por current_exception lança uma exceção, a exceção capturada é uma instância de 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.
Inheritance diagram
Funções de membro
constrói o objeto Original: constructs the The text has been machine-translated via Google Translate. (função pública membro) | |
copia o objeto Original: copies the object The text has been machine-translated via Google Translate. (função pública membro) | |
[virtual] |
retorna a seqüência explicativa Original: returns the explanatory string The text has been machine-translated via Google Translate. (função pública virtual membro) |
Herdado de std::exception
Member functions
destrói o objeto de exceção Original: destructs the exception object The text has been machine-translated via Google Translate. (of std::exception função pública virtual membro) [edit]
| |
retorna uma cadeia explicativa Original: returns an explanatory string The text has been machine-translated via Google Translate. (of std::exception função pública virtual membro) [edit]
| |
Exemplo
#include <iostream> #include <exception> #include <stdexcept> void my_unexp() { throw; } void test() throw(std::bad_exception) { throw std::runtime_error("test"); } int main() { std::set_unexpected(my_unexp); try { test(); } catch(const std::bad_exception& e) { std::cerr << "Caught " << e.what() << '\n'; } }
Saída:
Caught std::bad_exception