mp_units::non_negative¶
Marks a quantity that is never negative
Synopsis¶
Declared in <mp-units/framework/quantity_spec_definitions.h>
inline constexpr non_negative non_negative;
Description¶
A point measured from the natural_point_origin of such a quantity is checked not to lie below zero. A child quantity of real scalar character inherits the mark, unless it is defined with possibly_negative. The result of a quantity equation never carries it, because the sign of a quantity can't be read from its defining equation. A quantity defined only by an equation states it explicitly:
// litres per 100 km, which no engine runs below zero
inline constexpr struct fuel_consumption :
quantity_spec<isq::volume / isq::length, non_negative> {} fuel_consumption;
See Also¶
- Systems of Quantities in the User's Guide