std::strict_weak_order(3)

πŸ“¦
version 2024.07.05 Β· 3 versions
, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

okay so welcome to std::strict_weak_order(3), the C++ Standard Libary page that's about to make strict weak ordering make sense, bestie. The name is literally std::strict_weak_order β€” std::strict_weak_order. iconic, no notes. πŸ’…

✨ Synopsis ✨

Defined in header <concepts>:

template< class R, class T, class U >                (since C++20)
concept strict_weak_order = std::relation<R, T, U>;

The concept strict_weak_order<R, T, U> specifies that the relation R imposes a strict weak ordering on its arguments. that's the whole vibe check. πŸ¦‹

🧠 Semantic requirements 🧠

A relation r is a strict weak ordering if:

  • it is irreflexive: for all x, r(x, x) is false;
  • it is transitive: for all a, b and c, if r(a, b) and r(b, c) are both true then r(a, c) is true;
  • let e(a, b) be !r(a, b) && !r(b, a), then e is transitive: e(a, b) && e(b, c) implies e(a, c).

Under these conditions, it can be shown that e is an equivalence relation, and r induces a strict total ordering on the equivalence classes determined by e. like wow, math ate. 😭✨

πŸ“ Notes πŸ“

The distinction between relation and strict_weak_order is purely semantic. lowkey important, highkey just semantics. 🫢

πŸ‘€ See also πŸ‘€

  • LessThanComparable

mwah πŸ’‹ β€” source: cppreference.com, version/date 2024.06.10, page std::strict_weak_order(3). bye bestie, go slay your comparators πŸŒΈπŸ‘‘

πŸ“¦ where this page comes from