Skip to content

Commit 612390c

Browse files
committed
reuse the same clean callback
1 parent 4f225da commit 612390c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

include/reactor-cpp/multiport.hh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ private:
3333
inline void reset() noexcept { size_.store(0, std::memory_order_relaxed); }
3434

3535
[[nodiscard]] auto get_set_callback(std::size_t index) noexcept -> PortCallback;
36-
[[nodiscard]] auto get_clean_callback() noexcept -> PortCallback;
36+
const PortCallback clean_callback_{[this]([[maybe_unused]] const BasePort& port) { this->reset(); }};
37+
38+
[[nodiscard]] auto get_clean_callback() const noexcept -> PortCallback { return clean_callback_; }
3739

3840
protected:
3941
[[nodiscard]] inline auto present_ports() const -> const auto& { return present_ports_; }

lib/multiport.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ auto reactor::BaseMultiport::get_set_callback(std::size_t index) noexcept -> rea
1515
};
1616
}
1717

18-
auto reactor::BaseMultiport::get_clean_callback() noexcept -> reactor::PortCallback {
19-
// resets parent multiport
20-
return [this]([[maybe_unused]] const BasePort& port) { this->reset(); };
21-
}
2218

2319
void reactor::BaseMultiport::set_present(std::size_t index) {
2420
auto calculated_index = size_.fetch_add(1, std::memory_order_relaxed);

0 commit comments

Comments
 (0)