Namespaces
Variants

std::experimental:: promise (concurrency TS)

From cppreference.net

本页面介绍的是并发技术规范(concurrency TS)中提供的改进版 std::promise ,该版本支持该技术规范对 std::future 的增强功能。关于库基础技术规范(Library Fundamentals TS)提供的支持类型擦除分配器的 promise 版本,请参阅 std::experimental::fundamentals_v2::promise

定义于头文件 <experimental/future>
template < class R > class promise ;
(1) (并发TS)
template < class R > class promise < R & > ;
(2) (并发TS)
template <> class promise < void > ;
(3) (并发TS)

std::experimental::concurrency_v1::promise 是并发技术规范提供的 std::promise 改进版本,可与 std::experimental::future 协同工作。

std::promise 的唯一区别在于, get_future() 成员函数返回的是 std:: experimental :: future