mp_units::clamp_non_negative

Policy that clamps the value to [0, āˆž).]

Synopsis

Declared in <mp-units/overflow_policies.h>
struct clamp_non_negative;

Description

Saturates negative values to zero. Use when small negative values can arise from floating-point rounding in a naturally non-negative domain (e.g., a computed energy that rounds to āˆ’1eāˆ’15 J should be treated as 0 J rather than signalling an error).

Member Functions

Name
operator()

Data Members

Name
min