beman::optional::operator<

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>;
» more...

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>;
» more...

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>;
» more...

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

NameDescription
lhsThe left-hand optional.
rhsThe right-hand optional.