Equality operators
Synopses
Declared in <beman/optional/optional.hpp>
Compares two nullopt_t objects for equality.
constexpr
bool
operator==(
nullopt_t lhs,
nullopt_t rhs) noexcept;
Compares two optionals for equality.
template<
typename T,
typename U>
constexpr
bool
operator==(
optional<T> const& lhs,
optional<U> const& rhs)
requires detail::optional_eq_rel<T, U>;
Compares an optional against nullopt.
template<class T>
constexpr
bool
operator==(
optional<T> const& lhs,
nullopt_t rhs) noexcept;
Compares an engaged optional's value against a value for equality.
template<
typename T,
typename U>
constexpr
bool
operator==(
optional<T> const& lhs,
U const& rhs)
requires (!detail::is_optional<U>) && detail::optional_eq_rel<T, U>;
Compares a value against an engaged optional's value for equality.
template<
typename T,
typename U>
constexpr
bool
operator==(
T const& lhs,
optional<U> const& rhs)
requires (!detail::is_optional<T>) && detail::optional_eq_rel<T, U>;
Return Value
-
Always
true, since allnullopt_tobjects compare equal. -
trueif both are disengaged, or both are engaged and their contained values are equal. -
trueiflhsis disengaged. -
trueiflhsis engaged and its contained value equalsrhs. -
trueifrhsis engaged andlhsequals its contained value.
Parameters
Name |
Description |
lhs |
The left‐hand |
rhs |
The right‐hand |
Created with MrDocs