std::future_error — cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Déclaré dans l'en-tête <future> |
||
|
|
(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.
Inheritance diagram
Fonctions membres
crée un objet Original: creates a The text has been machine-translated via Google Translate. (fonction membre publique) [edit] | |
retourne le code d'erreur Original: returns the error code The text has been machine-translated via Google Translate. (fonction membre publique) [edit] | |
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. (fonction membre publique) [edit] | |
Inherited from std::logic_error
Inherited from std::exception
Member functions
[ virtuel Original: virtual The text has been machine-translated via Google Translate. |
Détruit l'objet exception Original: destructs the exception object The text has been machine-translated via Google Translate. (function membre virtuelle publique de std::exception) [edit]
|
[ virtuel Original: virtual The text has been machine-translated via Google Translate. |
retourne une chaîne explicative Original: returns an explanatory string The text has been machine-translated via Google Translate. (function membre virtuelle publique de std::exception) [edit]
|
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"
Voir aussi
identifie les codes d'erreur futures Original: identifies the future error codes The text has been machine-translated via Google Translate. (enum) [edit] | |