From 43d0b1cb2866bd4179eb1e4ff915931d74ee8640 Mon Sep 17 00:00:00 2001 From: Priyanshi507 Date: Tue, 19 May 2026 23:30:14 +0000 Subject: [PATCH] actions_base: reimplement HPX_DEFINE_PLAIN_ACTION_2 using reflection When HPX_HAVE_CXX26_REFLECTION is defined, HPX_DEFINE_PLAIN_ACTION_2 now expands to: using name = hpx::actions::reflect_action<^^func> instead of the verbose make_action_t struct definition. This keeps the exact same user-facing macro syntax (HPX_PLAIN_ACTION/ HPX_DEFINE_PLAIN_ACTION) while using C++26 reflection internally, eliminating the need for HPX_REGISTER_ACTION. The non-reflection paths (NVCC/CUDACC and standard) are preserved unchanged for backwards compatibility. Signed-off-by: Priyanshi507 --- .../actions_base/include/hpx/actions_base/macros.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/full/actions_base/include/hpx/actions_base/macros.hpp b/libs/full/actions_base/include/hpx/actions_base/macros.hpp index 29672c12175..c83fe80a2ff 100644 --- a/libs/full/actions_base/include/hpx/actions_base/macros.hpp +++ b/libs/full/actions_base/include/hpx/actions_base/macros.hpp @@ -486,7 +486,16 @@ HPX_DEFINE_PLAIN_ACTION_2(func, HPX_PP_CAT(func, _action)) \ /**/ -#if defined(__NVCC__) || defined(__CUDACC__) +#if defined(HPX_HAVE_CXX26_REFLECTION) +// clang-format off +/// When C++26 reflection is available, HPX_DEFINE_PLAIN_ACTION_2 uses +/// reflect_action<^^func> instead of make_action_t. This eliminates the +/// need for HPX_REGISTER_ACTION while keeping the same user-facing syntax. +#define HPX_DEFINE_PLAIN_ACTION_2(func, name) \ + using name = hpx::actions::reflect_action<^^func> \ + /**/ +// clang-format on +#elif defined(__NVCC__) || defined(__CUDACC__) #define HPX_DEFINE_PLAIN_ACTION_2(func, name) \ struct name \ : hpx::actions::make_action< \