Documentation Home >> Headers >> <future> Header

The <future> header provides facilities for handling asynchronous results from operations which may be performed on another thread.

namespace std
{
    enum class future_status {
        ready, timeout, deferred };

    enum class future_errc
    {
        broken_promise,
        future_already_retrieved,
        promise_already_satisfied,
        no_state
    };

    class future_error;

    const error_category& future_category();

    error_code make_error_code(future_errc e);
    error_condition make_error_condition(
        future_errc e);

    template<typename ResultType>
    class future;

    template<typename ResultType>
    class shared_future;

    template<typename ResultType>
    class atomic_future;

    template<typename ResultType>
    class promise;

    template<typename FunctionSignature>
    class packaged_task; // no definition provided

    template<typename ResultType,typename ... Args>
    class packaged_task<ResultType (Args...)>;

    enum class launch;

    template<typename FunctionType,typename ... Args>
    future<result_of<FunctionType(Args...)>::type>
    async(FunctionType&& func,Args&& ... args);

    template<typename FunctionType,typename ... Args>
    future<result_of<FunctionType(Args...)>::type>
    async(
        std::launch policy,FunctionType&& func,
        Args&& ... args);

    template<typename ResultType,typename Allocator>
    class std::vector<
        std::future<ResultType>,Allocator>;
}

namespace jss
{
    template<typename ... FutureTypes>
    std::future<std::tuple<FutureTypes...> >
    when_any(FutureTypes&&... futures);

    template<typename ... FutureTypes>
    std::future<std::tuple<FutureTypes...> >
    when_all(FutureTypes&&... futures);

}
See Also