std::bad_exception
Da cppreference.com
![]() |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
Definido no cabeçalho <exception>
|
||
class bad_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.
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.
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.
You can help to correct and verify the translation. Click here for instructions.
Índice |
[editar] Funções de membro
constrói o objeto 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. (função pública membro) | |
copia o objeto 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. (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. You can help to correct and verify the translation. Click here for instructions. (função pública virtual membro) |
Herdado de std::exception
Member functions
[virtual] |
destrói o objeto de exceção 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. (of std::exception função pública virtual membro)
|
[virtual] |
retorna uma cadeia explicativa 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. (of std::exception função pública virtual membro)
|
[editar] 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