Policy that checks the value is ≥ 0 and reports violations.
Synopsis
Declared in <mp‐units/overflow_policies.h>
struct check_non_negative;
Description
Intended for quantities that are inherently non‐negative (e.g., length, mass, duration). Automatically applied to natural_point_origin<QS> when QS is tagged non_negative in the ISQ.
If the quantity's representation type has a constraint_violation_handler specialization, the handler's on_violation() is called on negative values (providing guaranteed enforcement regardless of build mode). Otherwise, falls back to MP_UNITS_EXPECTS, which may be disabled in release builds.
Member Functions
Name |