~/talk

Using C++20's Three-way Comparison <=>

TalkinGermanat CppCon 2019 · 2019-09-15..09-20· [compilers-and-language-design, c-and-cpp]
links:none on file
slides:none on file

C++20's three-way comparison (<=>) lets classes delegate comparison logic to the compiler by writing a defaulted <=>, which yields lexicographic member-wise ordering and auto-generates == and relational operators to eliminate boilerplate. It introduces the comparison category types strong_ordering, weak_ordering, and partial_ordering, defines operator-rewriting rules for templates and containers, and discusses pitfalls such as floating-point partial orders, implicit conversions, and heterogeneous comparison overload resolution.

AI-written summary · about

  1. 0:00Introduction to C++20 comparison
  2. 7:31Default comparison operators
  3. 15:01Member function comparison
  4. 22:22Spaceship operator use cases
  5. 33:39Library and container support
  6. 40:45Global comparison operator
  7. 45:28Optional and custom comparison
  8. 51:33Summary and Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.