A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://en.cppreference.com/w/cpp/language/../ranges/../standard_library/synth-three-way.html below:

synth-three-way, synth-three-way-result - cppreference.com

constexpr auto synth-three-way = /* see below */;

(1) (since C++20)
(exposition only*) template< class T, class U = T >

using synth-three-way-result =

    decltype(synth-three-way(std::declval<T&>(), std::declval<U&>()));
(2) (since C++20)
(exposition only*) 1)

A function object whose

operator()

behaves as the synthesized three-way comparison function. Equivalent to:

constexpr auto synth-three-way =
    []<class T, class U>(const T& t, const U& u)
        requires requires
        {
            { t < u } -> boolean-testable;
            { u < t } -> boolean-testable;
        }
    {
        if constexpr (std::three_way_comparable_with<T, U>)
            return t <=> u;
        else
        {
            if (t < u)
                return std::weak_ordering::less;
            if (u < t)
                return std::weak_ordering::greater;
            return std::weak_ordering::equivalent;
        }
    };

2) The return type of the operator() of (1) (synth-three-way).

[edit] Parameters t, u - the values to be compared [edit] Return value

The compare result.

[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4