std::async

From Cppreference

Jump to: navigation, search
Defined in header <future>

template< class Function, class... Args>

std::future<typename std::result_of<Function(Args...)>::type>

    async( Function&& f, Args&&... args );
(1) (C++11 feature)
template< class Function, class... Args >

std::future<typename std::result_of<Function(Args...)>::type>

    async(std::launch policy, Function&& f, Args&&... args);
(2) (C++11 feature)

Contents

[edit] Parameters

f - function to call
args... - parameters to pass to f
policy - defines how to launch the function

[edit] Return value

std::future referring to the return value of the function.

[edit] Exceptions

[edit] Example