std::promise
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| 在头文件 <future> 中定义
|
||
| template< class T > class promise; |
(1) | (C++11 起) |
| template< class T > class promise<T&>; |
(2) | (C++11 起) |
| template<> class promise<void>; |
(3) | (C++11 起) |
。类模板
std::promise提供了一种机制来存储值,后来收购了异步通过一个std::future对象,std::promise可以提供.原文:
The class template
std::promise provides a facility to store a value that is later acquired asynchronously via a std::future object, that the std::promise can supply.| 本章尚未完成 |
目录 |
[编辑] 。成员函数。
| 建设诺言对象 (公共成员函数) | |
| destructs the promise object (公共成员函数) | |
| 分配的共享状态 (公共成员函数) | |
| 交换两个承诺的对象 (公共成员函数) | |
| |
| (公共成员函数) | |
| |
| sets the result to specific value (公共成员函数) | |
| 设置特定值的结果,同时提供了只有在线程退出的通知 原文: sets the result to specific value while delivering the notification only at thread exit (公共成员函数) | |
| 设定结果指示异常 原文: sets the result to indicate an exception (公共成员函数) | |
| 设置的结果显示异常,而只有在线程退出的通知交付 原文: sets the result to indicate an exception while delivering the notification only at thread exit (公共成员函数) | |
[编辑] 。非成员函数。
| (C++11) |
专业的std::swap算法 (函数模板) |
[编辑] 。 Helper类。
| 专业的std::uses_allocator型特征 原文: specializes the std::uses_allocator type trait (类模板特化) | |