mp_units::utility::operator==

Equality operators

Synopses

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

Checks whether a safe_int and a constrained value are equal

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

Checks whether a safe_int equals a floating-point value.

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

Checks whether a safe_int equals an integral scalar, comparing safely across signedness.

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

Checks whether two safe_int values wrap equal underlying values.

[[nodiscard]]
constexpr
bool
operator==(
    safe_int lhs,
    safe_int rhs) noexcept;
» more...

Return Value

  • true if the underlying values are equal
  • true if the wrapped value equals rhs
  • true if the wrapped values are equal

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