Skip to content

mp_units::check_non_negative

Policy that tests whether the value is ≥ 0.

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.

A checking policy like check_in_range. It only tests the value. A rejected value goes to the representation's constraint_violation_handler or, when there is none, violates the precondition of the operation that stores it.

Member Functions

NameDescription
operator() Tells whether v is zero or positive. Returns false for NaN.

Data Members

Name
min