std::exception_ptr

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>
typedef/*unspecified*/ exception_ptr;
(dal C++11)
std::exception_ptr è un nullable puntatore come tipo che gestisce un oggetto eccezione che è stato gettato e catturato con std::current_exception. Un'istanza di std::exception_ptr può essere passato a un'altra funzione, possibilmente su un altro thread, dove l'eccezione può essere rilanciata e trattati con una clausola 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.
Default-costruito std::exception_ptr è un puntatore nullo, non puntare a un oggetto eccezione.
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.
Due istanze di std::exception_ptr risultano uguali solo se sono entrambi NULL o entrambi punto in oggetto stessa eccezione.
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 non è convertibile in modo implicito qualsiasi aritmetica, enumerazione, o puntatore tipo. E 'convertibile in 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.
L'oggetto a cui fa riferimento un eccezione std::exception_ptr rimane valido fino a quando non ci rimane almeno un std::exception_ptr che lo sta riferimento: std::exception_ptr è un puntatore condiviso proprietà intelligente.
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.

[modifica]Esempio

[edit]
#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

Output:

Caught exception "basic_string::at"

[modifica]Vedi anche

crea un std::exception_ptr da un oggetto eccezione
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.

(funzione di modello)[modifica]
captures the current exception in a std::exception_ptr
(funzione)[modifica]
genera l'eccezione da un 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.

(funzione)[modifica]
close