std::compar...er_fallback(3)
π std::compare_strong_order_fallback β C++ Standard Libary page, but make it cute π
okay so this page is from the C++ Standard Libary manual β yes, thatβs literally how the manual name is spelled in the header, no cap. The header title is std::compar...er_fallback(3), but the actual main character is std::compare_strong_order_fallback. Itβs giving βfallback comparison but make it a strong orderingβ energy. π
β¨
β¨ NAME β¨
std::compare_strong_order_fallback β std::compare_strong_order_fallback
Likeβ¦ thatβs the whole NAME section, bestie. Weβre not gonna pretend it says more. π«Ά
πΈ Synopsis πΈ
Defined in header <compare> π
inline namespace /* unspecified */ {
inline constexpr /* unspecified */
(since C++20)
compare_strong_order_fallback = /* unspecified */;
}
Call signature π
template< class T, class U >
requires /* see below */
constexpr std::strong_ordering
(since C++20)
compare_strong_order_fallback( T&& t, U&& u ) noexcept(/* see below */);
Performs a three-way comparison on the subexpressions t and u, and produces a result of type std::strong_ordering, even if the operator <=> is unavailable. Iconic fallback behavior, honestly. π
If std::decay_t<T> and std::decay_t<U> are the same type, std::compare_strong_order_fallback(t, u) is expression-equivalent to: π
std::strong_order(t, u), if it is a well-formed expression;- otherwise,
t == u ? std::strong_ordering::equal : t < u ? std::strong_ordering::less : std::strong_ordering::greater
if the expressions t == u and t < u are both well-formed and each of decltype(t == u) and decltype(t < u) models boolean-testable, except that t and u are evaluated only once. Not me checking that twice β it literally says only once. π
In all other cases, std::compare_strong_order_fallback(t, u) is ill-formed, which can result in substitution failure when it appears in the immediate context of a template instantiation. Thatβs not being dramatic, thatβs just the rules. π
π Example π
This section is incomplete.
Reason: no example π«Ά
So no example bestie β itβs giving placeholder energy. π¦
π¦ Defect reports π¦
The following behavior-changing defect reports were applied retroactively to previously published C++ standards. πΈ
- DR:
LWG 2114(P2167R3) β Applied to:C++20β Behavior as published: the fallback mechanism only required return types to be convertible toboolβ Correct behavior: constraints strengthened
History said βletβs retcon this,β and honestly they ate. π
π See also π
strong_order(C++20) β performs 3-way comparison and produces a result of typestd::strong_ordering(customization point object)
Obsessed with this customization point object vibe, ngl. π
π Category π
- Todo no example
xoxo, your C++ Standard Libary group-chat bestie π source/version: http://cppreference.com Β· dated 2024.06.10 Β· page: std::compar...er_fallback(3). periodt. π
β¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms