mp_units::utility::operator<=>

Three-way comparison operators

Synopses

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

Compares a safe_int with a constrained value

[[nodiscard]]
constexpr
auto
operator<=>(
    safe_int lhs,
    constrained<U, CP> const& rhs);
» more...

Compares a safe_int with a floating-point value.

[[nodiscard]]
constexpr
auto
operator<=>(
    safe_int lhs,
    U rhs);
» more...

Compares a safe_int with an integral scalar, comparing safely across signedness.

[[nodiscard]]
constexpr
std::strong_ordering
operator<=>(
    safe_int lhs,
    U rhs);
» more...

Compares two safe_int values by their wrapped underlying values.

[[nodiscard]]
constexpr
std::strong_ordering
operator<=>(
    safe_int lhs,
    safe_int rhs) noexcept;
» more...

Return Value

  • the ordering of the underlying values
  • the ordering between the wrapped value and rhs
  • the ordering of the wrapped values

NOTE

The return value should not be discarded.

Template Parameters

NameDescription
Ua floating-point-like type (treat_as_floating_point<U> is true)

Parameters

NameDescription
lhsthe safe_int to compare
rhsthe constrained value to compare against