Skip to content

Commit

Permalink
Use correct macro to detect MSVC
Browse files Browse the repository at this point in the history
  • Loading branch information
alugowski committed Dec 14, 2023
1 parent d262dd2 commit 44f1d6e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/task_thread_pool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ namespace task_thread_pool {
#endif
>
TTP_NODISCARD std::future<R> submit(F&& func, A&&... args) {
#if defined(_MSVC_LANG)
// MSVC's packaged_task is not movable.
#if defined(_MSC_VER)
// MSVC's packaged_task is not movable even though it should be.
// Discussion about this bug and its future fix:
// https://developercommunity.visualstudio.com/t/unable-to-move-stdpackaged-task-into-any-stl-conta/108672
std::shared_ptr<std::packaged_task<R()>> ptask =
std::make_shared<std::packaged_task<R()>>(std::bind(std::forward<F>(func), std::forward<A>(args)...));
submit_detach([ptask] { (*ptask)(); });
Expand Down

0 comments on commit 44f1d6e

Please sign in to comment.