Skip to content

Commit 0fa0dcb

Browse files
committed
⬆️ Update stdx
Problem: - LLVM18 clang-tidy flags `handled` as able to be declared `const`. This is wrong, but what we're actually doing here is better expressed as `transform_reduce` on the bitset. Solution: - Use `transform_reduce`. Note: - `transform_reduce` is the operation here because we do not want to shortcut handling the message. `any_of` would be correct for that use case.
1 parent faedd52 commit 0fa0dcb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ include(cmake/string_catalog.cmake)
2525
add_versioned_package("gh:boostorg/mp11#boost-1.83.0")
2626
fmt_recipe(10.2.1)
2727
add_versioned_package("gh:intel/cpp-baremetal-concurrency#7c5b26c")
28-
add_versioned_package("gh:intel/cpp-std-extensions#2834680")
28+
add_versioned_package("gh:intel/cpp-std-extensions#37cc9c5")
2929
add_versioned_package("gh:intel/cpp-baremetal-senders-and-receivers#73d95bc")
3030

3131
set(GEN_STR_CATALOG

include/msg/detail/indexed_handler_common.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <stdx/compiler.hpp>
88
#include <stdx/ranges.hpp>
99

10+
#include <functional>
1011
#include <iterator>
1112
#include <type_traits>
1213
#include <utility>
@@ -49,9 +50,9 @@ struct indexed_handler : handler_interface<MsgBase, ExtraCallbackArgs...> {
4950
handle(MsgBase const &msg, ExtraCallbackArgs... args) const -> bool final {
5051
auto const callback_candidates = index(msg);
5152

52-
bool handled{};
53-
for_each([&](auto i) { handled |= callback_entries[i](msg, args...); },
54-
callback_candidates);
53+
bool const handled = transform_reduce(
54+
[&](auto i) -> bool { return callback_entries[i](msg, args...); },
55+
std::logical_or{}, false, callback_candidates);
5556

5657
if (not handled) {
5758
CIB_ERROR("None of the registered callbacks claimed this message.");

0 commit comments

Comments
 (0)