]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Simplify and comment std::jthread extension [PR100612]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 13 Feb 2025 00:26:27 +0000 (00:26 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Sat, 15 Feb 2025 11:02:20 +0000 (11:02 +0000)
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

index 7ded2a7aea431bb6ffb5436a47f2c423f3f92c3d..d2f91ad89953cfdb265c0c8c41827e13738fa162 100644 (file)
@@ -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<typename _Callable, typename... _Args>
       constexpr bool __pmf_expects_stop_token = false;
 
     template<typename _Callable, typename _Obj, typename... _Args>
+      requires is_member_function_pointer_v<remove_reference_t<_Callable>>
       constexpr bool __pmf_expects_stop_token<_Callable, _Obj, _Args...>
-       = __and_<is_member_function_pointer<remove_reference_t<_Callable>>,
-                is_invocable<_Callable, _Obj, stop_token, _Args...>>::value;
+       = is_invocable_v<_Callable, _Obj, stop_token, _Args...>;
 #endif
     /// @endcond