cpp/experimental/future:修订间差异

来自cppreference.com
Fruderica留言 | 贡献
无编辑摘要
Lynnboy留言 | 贡献
无编辑摘要
 
第2行: 第2行:
{{cpp/experimental/concurrency/future/navbar}}
{{cpp/experimental/concurrency/future/navbar}}
{{dcl begin}}
{{dcl begin}}
{{dcl header | experimental/future}}
{{dcl header|experimental/future}}
{{dcl | num=1 | since=concurrency |
{{dcl|num=1|since=concurrency|
template< class T > class future;
template< class T > class future;
}}
}}
{{dcl | num=2 | since=concurrency |
{{dcl|num=2|since=concurrency|
template< class T > class future<T&>;
template< class T > class future<T&>;
}}
}}
{{dcl | num=3 | since=concurrency |
{{dcl|num=3|since=concurrency|
template<>         class future<void>;
template<> class future<void>;
}}
}}
{{dcl end}}
{{dcl end}}


类模板 {{tt|std::experimental::future}} 以下列操作扩展 {{lc|std::future}}
类模板 {{tt|std::experimental::future}} 以下列操作扩展 {{lc|std::future}}:


* 使用 {{tt|future<future<T>>}} 的''解包装构造函数'';
* 使用 {{tt|future<future<T>>}} 的''解包装构造函数'';
* 查询关联共享状态是否就绪的 {{tt|is_ready}} ;以及
* 查询关联共享状态是否就绪的 {{tt|is_ready}};以及
* 附着持续到期货的成员函数 {{tt|then}}
* 附着持续到期货的成员函数 {{tt|then}}。


然而, {{tt|std::experimental::future}} 与 {{lc|std::future}} 间无相互操作。
然而,{{tt|std::experimental::future}} 与 {{lc|std::future}} 间无相互操作。


=== 成员函数 ===
=== 成员函数 ===
{{dsc begin}}
{{dsc begin}}
{{dsc inc | cpp/experimental/future/dsc constructor}}
{{dsc inc|cpp/experimental/future/dsc constructor}}
{{dsc inc | cpp/experimental/future/dsc is_ready}}
{{dsc inc|cpp/experimental/future/dsc is_ready}}
{{dsc inc | cpp/experimental/future/dsc then}}
{{dsc inc|cpp/experimental/future/dsc then}}
{{dsc inc | cpp/experimental/future/dsc operator{{=}}}}
{{dsc inc|cpp/experimental/future/dsc operator{{=}}}}
{{dsc end}}
{{dsc end}}


{{identical|std::future|
{{identical|std::future|
=== 成员函数 ===
=== 成员函数 ===
注意 {{tt|share()}} 返回 {{lc|std::experimental::shared_future<T>}} 。其他行为等同。
注意 {{tt|share()}} 返回 {{lc|std::experimental::shared_future<T>}}。其他行为等同。


{{dsc begin}}
{{dsc begin}}
{{dsc inc | cpp/thread/future/dsc destructor}}
{{dsc inc|cpp/thread/future/dsc destructor}}
{{dsc inc | cpp/thread/future/dsc share}}
{{dsc inc|cpp/thread/future/dsc share}}


{{dsc h2 | 设置结果}}
{{dsc h2|结果}}
{{dsc inc | cpp/thread/future/dsc get | future}}
{{dsc inc|cpp/thread/future/dsc get|future}}


{{dsc h2 | 状态}}
{{dsc h2|状态}}
{{dsc inc | cpp/thread/future/dsc valid | future}}
{{dsc inc|cpp/thread/future/dsc valid|future}}
{{dsc inc | cpp/thread/future/dsc wait | future}}
{{dsc inc|cpp/thread/future/dsc wait|future}}
{{dsc inc | cpp/thread/future/dsc wait_for | future}}
{{dsc inc|cpp/thread/future/dsc wait_for|future}}
{{dsc inc | cpp/thread/future/dsc wait_until | future}}
{{dsc inc|cpp/thread/future/dsc wait_until|future}}
{{dsc end}}
{{dsc end}}
}}
}}
第52行: 第51行:
===示例===
===示例===
{{example
{{example
| code=
|code=
}}
}}


===参阅===
===参阅===
{{dsc begin}}
{{dsc begin}}
{{dsc inc | cpp/experimental/dsc shared_future}}
{{dsc inc|cpp/experimental/dsc shared_future}}
{{dsc end}}
{{dsc end}}


{{langlinks|en}}
{{langlinks|en}}

2023年12月5日 (二) 12:06的最新版本