Open Jamaika1 opened 3 years ago
This is unlikely to be problem in ThreadPool. It properly includes <future>
.
That's right. I have a problem with functions under C++17 in mingw.future.h. https://github.com/meganz/mingw-std-threads/issues/75
/*#if (__cplusplus < 201703L)
std::future<std::result_of<std::decay<Function>::type(std::decay<Args>::type...)>::type>
#else
#if (__cplusplus > 201703L)
[[nodiscard]]
#endif
std::future<std::invoke_result_t<std::decay_t<Function>, std::decay_t<Args>...>>
#endif*/
#if (__cplusplus > 201703L)
[[nodiscard]]
#endif
std::future<__async_result_of<Function, Args...> >
async(Function&& f, Args&&... args)
{
return async(launch::async | launch::deferred, std::forward<Function>(f), std::forward<Args>(args)...);
}
template< class Function, class... Args >
/*#if (__cplusplus < 201703L)
std::future<std::result_of<std::decay<Function>::type(std::decay<Args>::type...)>::type>
#else
#if (__cplusplus > 201703L)
[[nodiscard]]
#endif
std::future<std::invoke_result_t<std::decay_t<Function>, std::decay_t<Args>...> >
#endif*/
#if (__cplusplus > 201703L)
[[nodiscard]]
#endif
std::future<__async_result_of<Function, Args...> >
async(std::launch policy, Function&& f, Args&&... args)
{
typedef __async_result_of<Function, Args...> result_type;
/*#if (__cplusplus < 201703L)
typedef std::result_of<std::decay<Function>::type(std::decay<Args>::type...)>::type result_type;
#else
typedef std::invoke_result_t<std::decay_t<Function>, std::decay_t<Args>...> result_type;
#endif*/
typedef future<result_type> future_type;
typedef typename future_type::state_type state_type;
//auto setter = []
state_type * state_ptr = nullptr;
/*if ((policy & std::launch::async) == std::launch::async)
state_ptr = new state_type ();
else
state_ptr = new state_type (std::function<result_type(void)>(std::bind(std::forward<Function>(f), std::forward<Args>(args)...)));*/
I use GCC 11 with library mingw. https://github.com/meganz/mingw-std-threads