名前空間
変種
操作

「cpp/thread/future errc」の版間の差分

提供: cppreference.com
< cpp‎ | thread
(Use {{lc}}. Update links. Various fixes.)
 
(1人の利用者による、間の1版が非表示)
1行: 1行:
{{tr_note}}
 
 
{{cpp/title|future_errc}}
 
{{cpp/title|future_errc}}
 
{{cpp/thread/future_errc/navbar}}
 
{{cpp/thread/future_errc/navbar}}
 
{{dcl begin}}
 
{{dcl begin}}
{{dcl header | ios}}
+
{{dcl header | }}
 
{{dcl | since=c++11 | 1=
 
{{dcl | since=c++11 | 1=
 
enum class future_errc {
 
enum class future_errc {
     broken_promise,
+
     broken_promise ,
     future_already_retrieved,
+
     future_already_retrieved ,
     promise_already_satisfied,
+
     promise_already_satisfied ,
     no_state
+
     no_state
 
};
 
};
 
}}
 
}}
 
{{dcl end}}
 
{{dcl end}}
  
The scoped enumeration {{tt|std::future_errc}} defines the error codes reported by {{lc|std::future}} and related classes in {{lc|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 {{tt|std::future_errc}} are implicitly convertible to {{lc|std::error_code}}.
+
{{tt|std::future_errc}} {{lc|std::future}} {{lc|std::future_error}} std::is_error_code_enum{{tt|std::future_errc}} {{lc|std::error_code}}
  
===メンバー定数===
+
 +
=
 +
 +
 +
 
 +
=====
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc hitem |{{tr| 定数 | Constant }}| Explanation}}
+
{{dsc hitem | 定数 | }}
{{dsc | {{tt|broken_promise}} | the asynchronous task abandoned its shared state }}
+
{{dsc | {{tt|broken_promise}} | }}
{{dsc | {{tt|future_already_retrieved}} | the contents of shared state were already accessed through {{lc|std::future}} }}
+
{{dsc | {{tt|future_already_retrieved}} | {{lc|std::future}} }}
{{dsc | {{tt|promise_already_satisfied}} | attempt to store a value in the shared state twice }}
+
{{dsc | {{tt|promise_already_satisfied}} | }}
{{dsc | {{tt|no_state}} | attempt to access {{lc|std::promise}} or {{lc|std::future}} without an associated shared state }}
+
{{dsc | {{tt|no_state}} | {{lc|std::promise}} {{lc|std::future}} }}
 
{{dsc end}}
 
{{dsc end}}
  
===ヘルパークラス===
+
======
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc tclass | cpp/thread/future_errc/is_error_code_enum  | title=is_error_code_enum{{dsc small|<std::future_errc>}}| notes={{mark c++11}} | extends the type trait {{lc|std::is_error_code_enum}} to identify future error codes}}
+
{{dsc | cpp/thread/future_errc/dsc }}
 +
{{| }}
 
{{dsc end}}
 
{{dsc end}}
  
===非メンバ関数===
+
======
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc fun | cpp/thread/future_errc/make_error_code | title=make_error_code{{dsc small|(std::future_errc)}} | notes={{mark c++11}} | constructs a future error code}}
+
{{dsc | cpp/thread/future_errc/dsc }}
{{dsc fun | cpp/thread/future_errc/make_error_condition  | title=make_error_condition{{dsc small|(std::future_errc)}} | notes={{mark c++11}} | constructs a future error_condition}}
+
 
{{dsc end}}
 
{{dsc end}}
 +
 +
 +
  
 
===例===
 
===例===
43行: 50行:
 
}}
 
}}
  
===も参照してください===
+
======
 
{{dsc begin}}
 
{{dsc begin}}
 
{{dsc inc | cpp/error/dsc error_code}}
 
{{dsc inc | cpp/error/dsc error_code}}

2018年3月10日 (土) 02:55時点における最新版

 
 
スレッドサポートライブラリ
スレッド
(C++11)
(C++20)
(C++20)
this_thread 名前空間
(C++11)
(C++11)
(C++11)
相互排他
(C++11)
汎用ロック管理
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
条件変数
(C++11)
セマフォ
ラッチとバリア
(C++20)
(C++20)
フューチャー
(C++11)
(C++11)
(C++11)
(C++11)
future_errc
(C++11)
 
std::future_errc
非メンバクラス
ヘルパークラス
 
ヘッダ <future> で定義
enum class future_errc {

    broken_promise             = /* implementation-defined */,
    future_already_retrieved   = /* implementation-defined */,
    promise_already_satisfied  = /* implementation-defined */,
    no_state                   = /* implementation-defined */

};
(C++11以上)

スコープ付き列挙型 std::future_errcstd::future および関連クラスによって std::future_error 例外オブジェクト内に報告されるエラーコードを定義します。 4つのエラーコードのみが要求されていますが、処理系は追加のエラーコードを定義する場合もあります。 std::is_error_code_enum の適切な特殊化が提供されるため、 std::future_errc 型の値は std::error_code に暗黙に変換可能です。

すべてのエラーコードは異なっており、非ゼロです。 (C++14以上)

目次

[編集] メンバ定数

定数 説明
broken_promise 非同期タスクは共有状態を放棄しました
future_already_retrieved 共有状態の内容はすでに std::future を通してアクセスされました
promise_already_satisfied 共有状態に値を2度格納しようとしました
no_state 紐付いた共有状態を持たない std::promise または std::future にアクセスしようとしました

[編集] 非メンバ関数

フューチャーのエラーコードを構築します
(関数) [edit]
フューチャーの error_condition を構築します
(関数) [edit]

[編集] ヘルパークラス

フューチャーのエラーコードを識別するために型特性 std::is_error_code_enum を拡張します
(クラステンプレート) [edit]

[編集] ノート

C++11 では、 std::error_code および std::error_condition が「エラーなし」を意味するためにゼロを使用するのに反して、 broken_promise がゼロに等しいと規定されていました。 これは C++14 で修正されました。

[編集]

[編集] 関連項目

プラットフォーム依存のエラーコードを保持します
(クラス) [edit]
移植性のあるエラーコードを保持します
(クラス) [edit]