Skip to content

mp_units::utility::operator==

Comparison of two uncertain values

Synopsis

Declared in <mp-units/utility/uncertain.h>

[[nodiscard]] constexpr bool operator==(uncertain const& lhs, uncertain const& rhs);

Note

This function is a hidden friend of uncertain, declared only inside that class: it can be found only through argument-dependent lookup.

Description

RealScalar requires std::totally_ordered, so a real scalar representation cannot opt out of ordering. Both the order and equality compare the central values only, so two values with the same central value and different uncertainties are equal, and the order is at most a weak one. A comparison with an exact value, such as a bound or zero, depends on the central value alone. The comparison is not statistical: two values with different central values compare as unequal even when their uncertainty intervals overlap. metrologically_compatible tells whether two values agree within their uncertainties, and certainly_within and possibly_within tell whether a value lies within limits. Compare uncertainty() to tell two values with the same central value apart.

Return Value

true if the objects are equal, false otherwise

Note

The return value should not be discarded.

Parameters

NameDescription
lhsThe left operand
rhsThe right operand