~/talk

A constexpr Virtual CRTP Comparison

Talkat C++Online 2025 · 2025-02-26..02-28· [c-and-cpp]
slides:none on file

Compares real code patterns: shows C++20/23 default spaceship makes cross-type comparisons compile and sometimes return true by argument-swapping, reproduces surprising cases where person==student wrongly succeeds, and demonstrates a working CRTP-based constexpr virtual solution that uses a per-type static constexpr identity (address-as-type-id) so equality is polymorphic and constexpr. Includes a C++20 fallback (custom constexpr type id) and a tested prototype that works but exposes compiler bugs on multiple/virtual bases.

AI-written summary · about

  1. 0:00Introduction
  2. 1:03Quiz on comparison
  3. 12:00Polymorphic types comparison
  4. 21:39Problems with comparison
  5. 30:17Virtual comparison attempt
  6. 36:18Second attempt with virtual
  7. 42:32CRTP for comparison
  8. 55:36Summary and solutions
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.