std::future_error
De 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. |
Déclaré dans l'en-tête <future>
|
||
class future_error; |
(depuis C++11) | |
Le std::future_error classe définit un objet d'exception qui est levée en cas d'échec par les fonctions de la bibliothèque de threads qui traitent de l'exécution asynchrone et les Etats partagée (std::future, std::promise, etc.) Semblable à std::system_error, cette exception porte un code d'erreur compatible avec std::error_code .
Original:
The class std::future_error defines an exception object that is thrown on failure by the functions in the thread library that deal with asynchronous execution and shared states (std::future, std::promise, etc). Similar to std::system_error, this exception carries an error code compatible with std::error_code.
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.
Sommaire |
[modifier] Fonctions membres
crée un objet std::future_error Original: creates a std::future_error objectThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
retourne le code d'erreur Original: returns the error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) | |
renvoie la chaîne explicative spécifique au code d'erreur Original: returns the explanatory string specific to the error code The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (fonction membre publique) |
Inherited from std::logic_error
Inherited from std::exception
Member functions
[ virtuel ]Original: virtual The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Détruit l'objet exception 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. (function membre virtuelle publique de std::exception )
|
[ virtuel ]Original: virtual The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
retourne une chaîne explicative 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. (function membre virtuelle publique de std::exception )
|
[modifier] Exemple
#include <future> #include <iostream> int main() { std::future<int> empty; try { int n = empty.get(); } catch (const std::future_error& e) { std::cout << "Caught a future_error with code \"" << e.code() << "\"\nMessage: \"" << e.what() << "\"\n"; } }
Résultat :
Caught a future_error with code "future:3" Message: "No associated state"
[modifier] Voir aussi
(C++11) |
identifie les codes d'erreur futures Original: identifies the future error codes The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (enum) |