is_weakly_ordered

Description

Checks if type T has order operators such as >, <, >= and <= and they are convertible to bool.

Requirements

The type T satisfies is_weakly_ordered if

Given:

  • a, and b expressions of type T or const T

The following expressions must be valid:

Expression Return type
a > b implicitly convertible to bool
a > b implicitly convertible to bool
a >= b implicitly convertible to bool
a <= b implicitly convertible to bool

Synopsis

TICK_TRAIT(is_weakly_ordered)
{
    template<class T>
    auto require(T&& x) -> valid<
        decltype(returns<bool>(x < x)),
        decltype(returns<bool>(x > x)),
        decltype(returns<bool>(x <= x)),
        decltype(returns<bool>(x >= x))
    >;

    template<class T, class U>
    auto require(T&& x, U&& y) -> valid<
        decltype(require(std::forward<T>(x))),
        decltype(require(std::forward<U>(y))),
        decltype(returns<bool>(x < y)),
        decltype(returns<bool>(y < x)),

        decltype(returns<bool>(x > y)),
        decltype(returns<bool>(y > x)),

        decltype(returns<bool>(x <= y)),
        decltype(returns<bool>(y <= x)),

        decltype(returns<bool>(x >= y)),
        decltype(returns<bool>(y >= x))
    >;
};