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);

Checks whether a safe_int equals a floating‐point value.

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

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

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

Checks whether two safe_int values wrap equal underlying values.

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

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

Name

Description

U

a floating‐point‐like type (treat_as_floating_point<U> is true)

Parameters

Name

Description

lhs

the safe_int to compare

rhs

the constrained value to compare against

Created with MrDocs