From c0988e263b4f8602c4b7bae8987ea9bda941dcce Mon Sep 17 00:00:00 2001 From: Michael Vandeberg Date: Wed, 1 Apr 2026 15:39:32 -0600 Subject: [PATCH] Align Executor concept and executor_ref with P4003 - Executor concept: pass continuation by reference in requires-expression to match stable-address semantics of all implementations - executor_ref constructor: constrain to Executor to reject non-conforming types at the call site instead of deferring to vtable instantiation - executor_ref::target(): add noexcept to both overloads (trivially non-throwing type-id comparison and static_cast) --- include/boost/capy/concept/executor.hpp | 2 +- include/boost/capy/ex/executor_ref.hpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/boost/capy/concept/executor.hpp b/include/boost/capy/concept/executor.hpp index d7582d9ff..cf2b1ac95 100644 --- a/include/boost/capy/concept/executor.hpp +++ b/include/boost/capy/concept/executor.hpp @@ -166,7 +166,7 @@ template concept Executor = std::is_nothrow_copy_constructible_v && std::is_nothrow_move_constructible_v && - requires(E& e, E const& ce, E const& ce2, continuation c) { + requires(E& e, E const& ce, E const& ce2, continuation& c) { { ce == ce2 } noexcept -> std::convertible_to; { ce.context() } noexcept; requires std::is_lvalue_reference_v && diff --git a/include/boost/capy/ex/executor_ref.hpp b/include/boost/capy/ex/executor_ref.hpp index f6010b7bd..245f16871 100644 --- a/include/boost/capy/ex/executor_ref.hpp +++ b/include/boost/capy/ex/executor_ref.hpp @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -149,7 +150,8 @@ class executor_ref std::decay_t, executor_ref>, int> = 0> #else template - requires (!std::same_as, executor_ref>) + requires (!std::same_as, executor_ref> + && Executor) #endif executor_ref(Ex const& ex) noexcept : ex_(&ex) @@ -266,7 +268,7 @@ class executor_ref `nullptr` if the type does not match. */ template< typename Executor > - const Executor* target() const + const Executor* target() const noexcept { if ( *vt_->type_id == detail::type_id< Executor >() ) return static_cast< Executor const* >( ex_ ); @@ -275,7 +277,7 @@ class executor_ref /// @copydoc target() const template< typename Executor> - Executor* target() + Executor* target() noexcept { if ( *vt_->type_id == detail::type_id< Executor >() ) return const_cast< Executor* >(