From: Jonathan Wakely Date: Thu, 13 Feb 2025 00:26:27 +0000 (+0000) Subject: libstdc++: Simplify and comment std::jthread extension [PR100612] X-Git-Tag: basepoints/gcc-16~1998 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e9ed0a05fddaba4e5257beaddb7cbaf31607a784;p=thirdparty%2Fgcc.git 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. --- diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index 7ded2a7aea4..d2f91ad8995 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