Less‐than operators

Synopses

Declared in <beman/optional/optional.hpp>

Orders two optionals with less‐than.

template<
    typename T,
    typename U>
constexpr
bool
operator<(
    optional<T> const& lhs,
    optional<U> const& rhs)
requires detail::optional_lt_rel<T, U>;

Orders an optional before a value with less‐than.

template<
    typename T,
    typename U>
constexpr
bool
operator<(
    optional<T> const& lhs,
    U const& rhs)
requires (!detail::is_optional<U>) && detail::optional_lt_rel<T, U>;

Orders a value before an optional with less‐than.

template<
    typename T,
    typename U>
constexpr
bool
operator<(
    T const& lhs,
    optional<U> const& rhs)
requires (!detail::is_optional<T>) && detail::optional_lt_rel<T, U>;

Return Value

  • true if lhs orders before rhs; a disengaged optional orders before any engaged one.

  • true if lhs is disengaged, or its contained value orders before rhs.

  • true if rhs is engaged and lhs orders before its contained value.

Parameters

Name

Description

lhs

The left‐hand optional.

rhs

The right‐hand optional.

Created with MrDocs