From e9ed0a05fddaba4e5257beaddb7cbaf31607a784 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 13 Feb 2025 00:26:27 +0000 Subject: [PATCH] libstdc++: Simplify and comment std::jthread extension [PR100612] Use a requires-clause on the partial specialization of the __pmf_expects_stop_token variable template, which is used for the extension that allows constructing std::jthread with a pointer-to-member-function that accepts a std::stop_token argument. Also add a comment referring to the related Bugzilla PR. libstdc++-v3/ChangeLog: PR libstdc++/100612 * include/std/thread (__pmf_expects_stop_token): Constrain variable template specialization with concept. Add comment. --- libstdc++-v3/include/std/thread | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index 7ded2a7aea43..d2f91ad89953 100644 --- a/libstdc++-v3/include/std/thread +++ b/libstdc++-v3/include/std/thread @@ -123,13 +123,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @cond undocumented #ifndef __STRICT_ANSI__ + // As an extension we support invoking a pointer-to-member-function that + // expects a stop_token as the first argument. See PR libstdc++/100612. template constexpr bool __pmf_expects_stop_token = false; template + requires is_member_function_pointer_v> constexpr bool __pmf_expects_stop_token<_Callable, _Obj, _Args...> - = __and_>, - is_invocable<_Callable, _Obj, stop_token, _Args...>>::value; + = is_invocable_v<_Callable, _Obj, stop_token, _Args...>; #endif /// @endcond -- 2.47.3