mp_units::clamp_to_range

Policy that clamps the value to [min, max].

Synopsis

Declared in <mp-units/overflow_policies.h>

template<Quantity Q>
struct clamp_to_range;

Description

Saturates out-of-range values to the nearest boundary. Use when you want to "correct" invalid values rather than signal an error.

Member Functions

NameDescription
operator() Clamps v to [min, max].

Data Members

NameDescription
max The upper boundary of the allowed range
min The lower boundary of the allowed range