std::weak_order(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

🌸 NAME 🌸

okay so bestie, you're in the C++ Standard Libary manual β€” yes, that spelling is in the header, not my fault πŸ’… β€” and this is the page for std::weak_order(3). The NAME line is literally std::weak_order - std::weak_order. Self-titled icon behavior, no cap. πŸ‘‘

✨ Synopsis ✨

Defined in header <compare>.

inline namespace /* unspecified */ {

    inline constexpr /* unspecified */ weak_order = /* unspecified (since C++20) */;

}

πŸ“ž Call signature πŸ“ž

template< class T, class U >

    requires /* see below */

constexpr std::weak_ordering weak_order(T&& t, U&& u) noexcept(/* see below */);

It compares two values using 3-way comparison and produces a result of type std::weak_ordering. slay. πŸ’–

Let t and u be expressions and T and U denote decltype((t)) and decltype((u)) respectively, std::weak_order(t, u) is expression-equivalent to:

  • If std::is_same_v<std::decay_t<T>, std::decay_t<U>> is true:
    • std::weak_ordering(weak_order(t, u)), if it is a well-formed expression with overload resolution performed in a context that does not include a declaration of std::weak_order,
    • otherwise, if T is a floating-point type:
      • if std::numeric_limits<T>::is_iec559 is true, performs the weak ordering comparison of floating-point values (see below) and returns that result as a value of type std::weak_ordering,
      • otherwise, yields a value of type std::weak_ordering that is consistent with the ordering observed by T's comparison operators,
    • otherwise, std::weak_ordering(std::compare_three_way()(t, u)), if it is well-formed,
    • otherwise, std::weak_ordering(std::strong_order(t, u)), if it is well-formed.
  • In all other cases, the expression is ill-formed, which can result in substitution failure when it appears in the immediate context of a template instantiation.

πŸŽ€ Example πŸŽ€

This section is incomplete.

Reason: no example.

the lore is literally still loading 😭

πŸ¦‹ See also πŸ¦‹

  • weak_ordering (C++20) β€” the result type of 3-way comparison that supports all 6 operators and is not substitutable (class).
  • strong_order (C++20) β€” performs 3-way comparison and produces a result of type std::strong_ordering (customization point object).
  • partial_order (C++20) β€” performs 3-way comparison and produces a result of type std::partial_ordering (customization point object).
  • compare_weak_order_fallback (C++20) β€” performs 3-way comparison and produces a result of type std::weak_ordering, even if operator<=> is unavailable (customization point object).

πŸ’… Category πŸ’…

  • Todo no example

kisses bestie, this page came from http://cppreference.com, dated 2024.06.10, and it's your girl std::weak_order(3) signing off πŸ’–βœ¨

πŸ“¦ where this page comes from