future

标准库标头<future>

此标头是螺纹支撑图书馆。

*。

承诺%28C++11%29存储异步检索%28类模板%29的值

包装[医]任务%28C++11%29包一个函数来存储异步检索%28class模板%29的返回值

未来的%28C++11%29等待异步设置的值%28类模板%29

共享[医]未来的%28C++11%29等待一个值%28可能被异步设置的其他期货%29引用

启动%28C++11%29指定STD的启动策略::异步%28 enum%29

未来[医]状态%28C++11%29指定对std::期货和std::Shared执行计时等待的结果。[医]未来%28%29

未来[医]错误%28C++11%29报告与期货相关的错误或承诺%28C++11%29

未来[医]ERRC%28C++11%29标识未来错误代码%28 enum%29

STD::用途[医]分配器<std::答应>%28C++11%29专门使用std::用途[医]分配器类型特征%28类模板专门化%29

STD::用途[医]分配器<std::打包[医]任务>%28C++11%29%28直到C++17%29专门研究STD::Use[医]分配器类型特征%28类模板专门化%29

功能

异步%28C++11%29在新线程%29中异步运行函数%28,并返回包含结果%28函数模板%29的std::期货

未来[医]类别%28C++11%29标识未来错误类别%28功能%29

Sd::交换%28std::承诺%29%28C++11%29专门使用std::swp算法%28函数模板%29

STD::SWAP%28std::Package[医]任务%29%28C++11%29专门用于std::交换算法%28函数模板%29

简介

二次

namespace std { enum class future_errc { broken_promise = /*implementation-defined*/, future_already_retrieved = /*implementation-defined*/, promise_already_satisfied = /*implementation-defined*/, no_state = /*implementation-defined*/ }; enum class launch : /*unspecified*/ { async = /*unspecified*/, deferred = /*unspecified*/, /*implementation-defined*/ }; enum class future_status { ready, timeout, deferred }; template <> struct is_error_code_enum<future_errc> : public true_type { }; error_code make_error_code(future_errc e) noexcept; error_condition make_error_condition(future_errc e) noexcept; const error_category& future_category() noexcept; class future_error; template <class R> class promise; template <class R> class promise<R&>; template <> class promise<void>; template <class R> void swap(promise<R>& x, promise<R>& y) noexcept; template <class R, class Alloc> struct uses_allocator<promise<R>, Alloc> : true_type {}; template <class R> class future; template <class R> class future<R&>; template <> class future<void>; template <class R> class shared_future; template <class R> class shared_future<R&>; template <> class shared_future<void>; template <class> class packaged_task; // undefined template <class R, class... ArgTypes> class packaged_task<R(ArgTypes...)>; template <class R> void swap(packaged_task<R(ArgTypes...)>&, packaged_task<R(ArgTypes...)>&) noexcept; template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc> : true_type {}; template <class F, class... Args> future<result_of_t<decay_t<F>(decay_t<Args>...)>> async(F&& f, Args&&... args template <class F, class... Args> future<result_of_t<decay_t<F>(decay_t<Args>...)>> async(launch policy, F&& f, Args&&... args }

二次

类std::future_error

二次

class future_error : public logic_error { public: future_error(error_code ec // exposition only const error_code& code() const noexcept; const char* what() const noexcept; };

二次

类std::promise

二次

template <class R> class promise { public: promise( template <class Allocator> promise(allocator_arg_t, const Allocator& a promise(promise&& rhs) noexcept; promise(const promise& rhs) = delete; ~promise( // assignment promise& operator=(promise&& rhs) noexcept; promise& operator=(const promise& rhs) = delete; void swap(promise& other) noexcept; // retrieving the result future<R> get_future( // setting the result void set_value(/*see description*/ void set_exception(exception_ptr p // setting the result with deferred notification void set_value_at_thread_exit(/*see description*/ void set_exception_at_thread_exit(exception_ptr p };

二次

类std::future

二次

template <class R> class future { public: future() noexcept; future(future &&) noexcept; future(const future& rhs) = delete; ~future( future& operator=(const future& rhs) = delete; future& operator=(future&&) noexcept; shared_future<R> share( // retrieving the value /*see description*/ get( // functions to check state bool valid() const noexcept; void wait() const; template <class Rep, class Period> future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const; template <class Clock, class Duration> future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const; };

二次

类std::shared_future

二次

template <class R> class shared_future { public: shared_future() noexcept; shared_future(const shared_future& rhs shared_future(future<R>&&) noexcept; shared_future(shared_future&& rhs) noexcept; ~shared_future( shared_future& operator=(const shared_future& rhs shared_future& operator=(shared_future&& rhs) noexcept; // retrieving the value /*see description*/ get() const; // functions to check state bool valid() const noexcept; void wait() const; template <class Rep, class Period> future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const; template <class Clock, class Duration> future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const; };

二次

类std::packaged_task

二次

template<class> class packaged_task; // undefined template<class R, class... ArgTypes> class packaged_task<R(ArgTypes...)> { public: // construction and destruction packaged_task() noexcept; template <class F> explicit packaged_task(F&& f template <class F, class Allocator> explicit packaged_task(allocator_arg_t, const Allocator& a, F&& f ~packaged_task( // no copy packaged_task(const packaged_task&) = delete; packaged_task& operator=(const packaged_task&) = delete; // move support packaged_task(packaged_task&& rhs) noexcept; packaged_task& operator=(packaged_task&& rhs) noexcept; void swap(packaged_task& other) noexcept; bool valid() const noexcept; // result retrieval future<R> get_future( // execution void operator()(ArgTypes... void make_ready_at_thread_exit(ArgTypes... void reset( };

二次

© cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

http://en.cppreference.com/w/cpp/报头/前途