Namensräume
Varianten
Aktionen

std::exception_ptr

Aus cppreference.com
< cpp‎ | error

 
 
 
Fehlerbehandlung
Exception Handling
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)
Ausnahmebehandlung Ausfälle
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(veraltet)
bad_exception
unexpected_handler(veraltet)
get_unexpected(C++11)(veraltet)
set_unexpected(veraltet)
Exception Kategorien
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
Fehlercodes
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.
Fehlercodes
errno
Assertions
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
system_error Anlage
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)
 
definiert in Header <exception>
typedef /*unspecified*/ exception_ptr;
(seit C++11)
std::exception_ptr ist ein NULL-Zeiger-wie Typ, der eine Ausnahme Objekt, das geworfen wurde und eroberte mit std::current_exception verwaltet. Eine Instanz std::exception_ptr kann eine andere Funktion übergeben werden, möglicherweise auf einem anderen Thread, wo die Ausnahme kann erneut ausgelöst und behandelt werden mit einer catch-Klausel .
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-gebaut std::exception_ptr wird ein NULL-Zeiger, ist es nicht zu einer Ausnahme Objekt zeigen .
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.
Zwei Instanzen std::exception_ptr sind gleich, wenn sie beide null oder beide auf gleicher Exception-Objekt sind .
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 weder implizit konvertierbar beliebigen arithmetischen, Enumeration oder Zeigertyp. Es ist konvertierbar 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.
Das Exception-Objekt von einem std::exception_ptr verwiesen wird, bleibt so lange gültig, wie es bleibt mindestens ein std::exception_ptr, die darauf verweisen wird: std::exception_ptr ist ein Shared-Ownership Smart-Pointer .
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.

[Bearbeiten] Beispiel

[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(const std::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"

[Bearbeiten] Siehe auch

schafft eine std::exception_ptr von einer Ausnahme-Objekt
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.

(Funktions-Template) [edit]
captures the current exception in a std::exception_ptr
(Funktion) [edit]
wirft die Ausnahme von einem 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.

(Funktion) [edit]