AfterNthChange Filter

template<typename T, size_t N>
struct AfterNthChange

Filter that starts accepting after N changes.

This stateful filter ignores the first N changes and then propagates all subsequent changes, useful for skipping initialization or warmup phases.

Since

v0.1.0

// Example: Start accepting after 3 changes (skip initialization)
Signal<float, 10, AfterNthChange<float, 3>> stable(0.0);

Note

Stateful filter. Propagates all changes after N.

Warning

  • N must be greater than 0.

Template Parameters:
typename T

Any type.

size_t N

Number of changes to ignore.

Public Functions

inline bool operator()(const T &old_value, const T &new_value) const

Public Members

mutable size_t counter = 0
mutable bool is_above_n = false

See Also