std::future_errc(3)
π std::future_errc π
okay so bestie, this is the std::future_errc(3) page from the C++ Standard Libary manual β yes, the header spells it like that, and weβre not fixing it, weβre just vibing π«Ά. Itβs giving βtiny enum, big error-code energy,β and Iβm obsessed.
πΈ NAME πΈ
std::future_errc β std::future_errc (the name is literally the name, bestie π
).
β¨ Synopsis β¨
Defined in header <future>
enum class future_errc {
broken_promise = /* implementation-defined */,
future_already_retrieved = /* implementation-defined */,
(since C++11)
promise_already_satisfied = /* implementation-defined */,
no_state = /* implementation-defined */
};
The scoped enumeration std::future_errc defines the error codes reported by std::future and related classes in std::future_error exception objects. Only four error codes are required, although the implementation may define additional error codes. Because the appropriate specialization of std::is_error_code_enum is provided, values of type std::future_errc are implicitly convertible to std::error_code.
All error codes are distinct and non-zero. No cap, every single one is doing its own thing and none of them are zero β zero is not invited to this party π.
π Member constants π
broken_promiseβ the asynchronous task abandoned its shared state.future_already_retrievedβ the contents of shared state were already accessed throughstd::future.promise_already_satisfiedβ attempt to store a value in the shared state twice.no_stateβ attempt to accessstd::promiseorstd::futurewithout an associated shared state.
π Non-member functions π
make_error_code(std::future_errc)β constructs a future error code;(C++11); function.make_error_condition(std::future_errc)β constructs a futureerror_condition;(C++11); function.
π Helper classes π
is_error_code_enum<std::future_errc>β extends the type traitstd::is_error_code_enumto identify future error codes;(C++11); class template.
π Example π
This section is incomplete
Reason: no example
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR
LWG 2056β Applied to:C++11. Behavior as published:broken_promisewas specified to be zero which is conventionally used to mean"no error". Correct behavior: specified to be non-zero.
π¦ See also π¦
error_codeβ holds a platform-dependent error code;(C++11); class.error_conditionβ holds a portable error code;(C++11); class.
β Category β
- Todo no example
source/version/date check: this oneβs from http://cppreference.com, version 2024.06.10, and itβs the std::future_errc(3) page β bye bestie, go handle your error codes π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms