#ifndef _ASYNCO_ #define _ASYNCO_ #include "engine.hpp" #include using namespace std; namespace marcelb { namespace asynco { /** * Run the function asynchronously */ template auto async_(F&& f, Args&&... args) -> future::type> { using return_type = typename result_of::type; future res = _asynco_engine.io_context.post(boost::asio::use_future(bind(forward(f), forward(args)...))); return res; } /** * Block until the asynchronous call completes */ template T await_(future& r) { return r.get(); } /** * Block until the asynchronous call completes */ template T await_(future&& r) { return move(r).get(); } } } #endif