Espaços nominais
Variantes
Acções

std::exception_ptr

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.
exception_ptr
(C++11)
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)
(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>
typedef/*unspecified*/ exception_ptr;
(desde C++11)
std::exception_ptr é um tipo de ponteiro-como anulável que gerencia um objeto de exceção que foi lançada e capturado com std::current_exception. Uma instância de std::exception_ptr pode ser passado para outra função, possivelmente em outro segmento, onde a exceção pode ser relançada e manipulados com uma cláusula catch.
Original:
std::exception_ptr is a nullable pointer-like type that manages an exception object which has been thrown and captured with std::current_exception. An instance of std::exception_ptr may be passed to another function, possibly on another thread, where the exception may be rethrown and handled with a catch clause.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Padrão construído std::exception_ptr é um ponteiro nulo, ele não aponta para um objeto de exceção.
Original:
Default-constructed std::exception_ptr is a null pointer, it does not point to an exception object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Dois casos de std::exception_ptr comparar iguais somente se ambos são nulos ou ambos ponto no objeto de exceção mesmo.
Original:
Two instances of std::exception_ptr compare equal only if they are both null or both point at the same exception object.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
std::exception_ptr não é implicitamente conversível para qualquer aritmética, enumeração, ou tipo de ponteiro. É convertida para bool.
Original:
std::exception_ptr is not implicitly convertible to any arithmetic, enumeration, or pointer type. It is convertible to bool.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
O objeto de exceção referenciado por um std::exception_ptr permanece válido enquanto ainda há pelo menos um std::exception_ptr que é referência a ele: std::exception_ptr é um ponteiro-propriedade compartilhada inteligente.
Original:
The exception object referenced by an std::exception_ptr remains valid as long as there remains at least one std::exception_ptr that is referencing it: std::exception_ptr is a shared-ownership smart pointer.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[editar]Exemplo

#include <iostream>#include <string>#include <exception>#include <stdexcept>   void handle_eptr(std::exception_ptr eptr)// passing by value is ok{try{if(eptr != std::exception_ptr()){ std::rethrow_exception(eptr);}}catch(conststd::exception& e){std::cout<<"Caught exception \""<< e.what()<<"\"\n";}}   int main(){ std::exception_ptr eptr;try{std::string().at(1);// this generates an std::out_of_range}catch(...){ eptr =std::current_exception();// capture} handle_eptr(eptr);}// destructor for std::out_of_range called here, when the eptr is destructed

Saída:

Caught exception "basic_string::at"

[editar]Veja também

cria uma std::exception_ptr a partir de um objeto de exceção
Original:
creates an std::exception_ptr from an exception object
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(modelo de função)[edit]
captures the current exception in a std::exception_ptr
(função)[edit]
lança a exceção de um std::exception_ptr
Original:
throws the exception from an std::exception_ptr
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(função)[edit]
close