From 44f1d6ee2ba8bed4873cb5b24b3cd1d8bf825b48 Mon Sep 17 00:00:00 2001 From: Adam Lugowski Date: Wed, 13 Dec 2023 20:28:12 -0800 Subject: [PATCH] Use correct macro to detect MSVC --- include/task_thread_pool.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/task_thread_pool.hpp b/include/task_thread_pool.hpp index fdf0ae6..6029e85 100644 --- a/include/task_thread_pool.hpp +++ b/include/task_thread_pool.hpp @@ -279,8 +279,10 @@ namespace task_thread_pool { #endif > TTP_NODISCARD std::future 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> ptask = std::make_shared>(std::bind(std::forward(func), std::forward(args)...)); submit_detach([ptask] { (*ptask)(); });