Espaços nominais
Variantes
Acções

std::bad_exception

Da cppreference.com
< cpp‎ | error

 
 
Biblioteca de utilitários
Digite apoio (basic types, RTTI, type traits)
Gerenciamento de memória dinâmica
De tratamento de erros
Utilidades do programa
Variadic funções
Data e hora
Objetos de função
(C++11)
Os operadores relacionais
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>=
Pares e tuplas
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.
(C++11)
Troque, avançar e avançar
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.
(C++11)
(C++11)
(C++11)
 
De tratamento de erros
Manipulação de exceção
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.
Manipulação de falhas de exceção
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.
(obsoleta)
bad_exception
(C++11)(obsoleta)
(obsoleta)
Categorias de exceção
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.
Códigos de erro
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.
Códigos de erro
Afirmações
Original:
Assertions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
instalação 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.
(C++11)
(C++11)
 
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.
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.
cpp/error/exceptionstd-bad exception-inheritance.svg
Sobre esta imagem

Inheritance diagram

Índice

[editar] Funções de membro

constrói o objeto 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.

(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) [edit]
[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) [edit]

[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