From 47906ea954bc24ad6492c6ea959479e1a635f1c6 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Sat, 13 Jan 2024 15:38:09 -0600 Subject: [PATCH] Use scope_exit --- .../hpx/collectives/detail/communicator.hpp | 25 +++---------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/libs/full/collectives/include/hpx/collectives/detail/communicator.hpp b/libs/full/collectives/include/hpx/collectives/detail/communicator.hpp index ec21d34f192f..bfc2d895ea40 100644 --- a/libs/full/collectives/include/hpx/collectives/detail/communicator.hpp +++ b/libs/full/collectives/include/hpx/collectives/detail/communicator.hpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -244,27 +245,6 @@ namespace hpx::collectives::detail { return fut; } - template - struct on_exit - { - explicit constexpr on_exit(F&& f_) noexcept - : f(HPX_MOVE(f_)) - { - } - - on_exit(on_exit const&) = delete; - on_exit(on_exit&&) = delete; - on_exit& operator=(on_exit const&) = delete; - on_exit& operator=(on_exit&&) = delete; - - ~on_exit() - { - f(); - } - - F f; - }; - // Step will be invoked under lock for each site that checks in (either // set or get). // @@ -320,7 +300,8 @@ namespace hpx::collectives::detail { // On exit, keep track of number of invocations of this // callback. - on_exit _([this] { ++on_ready_count_; }); + auto on_exit = hpx::experimental::scope_exit( + [this] { ++on_ready_count_; }); if constexpr (!std::is_same_v>)