KeySelector Filter

template<typename T, auto KeyFunc>
struct KeySelector

Filter that compares values by a key extracted via function.

This filter extracts a key from values using a compile-time function and propagates only when the keys differ, enabling custom comparison logic.

Since

v0.1.0

// Example: Compare structs by ID field only
struct Data { int id; float value; };
auto get_id = [](const Data& d) { return d.id; };
Signal<Data, 10, KeySelector<Data, get_id>> item({0, 0.0});

Warning

  • KeyFunc must be callable with argument of type T.

  • Return type of KeyFunc must support operator!=.

Template Parameters:
typename T

Value type.

auto KeyFunc

Compile-time key extraction function.

Public Functions

inline bool operator()(const T &lhs, const T &rhs) const

See Also