在线文档教程
C++
线程支持 | Thread support

std::future_errc

科技促进发展:未来[医]ERRC

Defined in header
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)

成员常数

ConstantExplanation
broken_promisethe asynchronous task abandoned its shared state
future_already_retrievedthe contents of shared state were already accessed through std::future
promise_already_satisfiedattempt to store a value in the shared state twice
no_stateattempt 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 (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。

http://en.cppreference.com/w/cpp/线程/前途[医]ERRC