WithinRange Filter

template<typename T, T MinVal, T MaxVal>
struct WithinRange

Filter that only accepts values within a specified range.

This filter propagates changes only when the new value falls within the specified inclusive range [MinVal, MaxVal], useful for range validation.

Since

v0.1.0

// Example: Only propagate values within valid range [0, 100]
Signal<int, 10, WithinRange<int, 0, 100>> percent(50);

Warning

  • Only accepts arithmetic types (integral and floating-point).

  • MinVal must be less than or equal to MaxVal.

Template Parameters:
typename T

Arithmetic type.

T MinVal

Minimum value of inclusion range.

T MaxVal

Maximum value of inclusion range.

Public Functions

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

See Also