std::future_errc
Defined in header <future> | | |
|---|---|---|
enum class future_errc { broken_promise = /* implementation-defined */, future_already_retrieved = /* implementation-defined */, promise_already_satisfied = /* implementation-defined */, no_state = /* implementation-defined */ }; | | (since C++11) |
范围枚举std::future_errc定义报告的错误代码。std::future及相关课程std::future_error异常对象。只需要四个错误代码,尽管实现可以定义其他错误代码。因为适当的专门化std::is_error_code_enum提供类型的值。std::future_errc隐式可转换为std::error_code...
All error codes are distinct and non-zero. | (since C++14) |
|---|
成员常数
Constant | Explanation |
|---|---|
broken_promise | the asynchronous task abandoned its shared state |
future_already_retrieved | the contents of shared state were already accessed through std::future |
promise_already_satisfied | attempt to store a value in the shared state twice |
no_state | attempt to access std::promise or std::future without an associated shared state |
非会员职能
make_error_code(std::future_errc) (C++11) | constructs a future error code (function) |
|---|---|
make_error_condition(std::future_errc) (C++11) | constructs a future error_condition (function) |
帮助者类
is_error_code_enum<std::future_errc> (C++11) | extends the type trait std::is_error_code_enum to identify future error codes (class template) |
|---|
注记
在C++11中,broken_promise被指定为等于零,尽管std::error_code/std::error_condition用零表示“没有错误”。这是在C++14中修正的。
例
另见
error_code (C++11) | holds a platform-dependent error code (class) |
|---|---|
error_condition (C++11) | holds a portable error code (class) |
© cppreference.com在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com

