replace static_assert bad complex idiom with simpler one #102

Merged
falsycat merged 1 commits from feature/101-static-assert into main 2023-07-24 12:40:32 +00:00

View File

@ -117,9 +117,7 @@ class TaskQueue : public std::enable_shared_from_this<TaskQueue<Args...>> {
} else if constexpr (std::is_invocable_v<F, decltype(args1)...>) { } else if constexpr (std::is_invocable_v<F, decltype(args1)...>) {
f(std::forward<decltype(args1)>(args1)...); f(std::forward<decltype(args1)>(args1)...);
} else { } else {
[]<bool kValidFunction = false>() { static_assert(false, "the wrapped function is invalid");
static_assert(kValidFunction, "a function to wrap is invalid");
}();
} }
}, },
loc, loc,