名稱空間
變體
操作

std::experimental::promise (併發 TS)

來自 cppreference.com

本頁面介紹的是併發 TS 提供的 std::promise 的修改版本,它支援該 TS 對 std::future 所做的改進。對於由庫基礎 TS 提供的支援型別擦除分配器的 promise 版本,請參閱 std::experimental::fundamentals_v2::promise

定義於標頭檔案 <experimental/future>
template< class R > class promise;
(1) (併發技術規範)
template< class R > class promise<R&>;
(2) (併發技術規範)
template<>          class promise<void>;
(3) (併發技術規範)

std::experimental::concurrency_v1::promise 是併發 TS 提供的 std::promise 的修改版本,它與 std::experimental::future 協同工作。

std::promise 唯一的區別在於,get_future() 成員函式返回一個 std::experimental::future