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

Name

Description

operator()

Clamps v to [`min`, max].

Data Members

Name

Description

max

The upper boundary of the allowed range

min

The lower boundary of the allowed range

Created with MrDocs