C++20 - My Favorite Code Examples
summary
Presents concrete C++20 code combining features and shows what actually works: spaceship operator for automatic comparisons, ranges views (drop, filter) and the new ranges begin/end helpers, std::format for output, extended chrono calendar/timezone types, concepts and NTTPs, and consteval compile-time merge that builds an array plus size. Demonstrates a constexpr vector workflow that compiles on recent Visual C++ but flags portability limits, returns a compile-time array+count to avoid runtime vector propagation, and documents which snippets succeed and which compilers choke.
AI-written summary · about
chapters (15)
- 0:00Intro
- 0:54Sort
- 7:53Filter
- 15:05sentinel
- 16:57rewrite comparisons
- 19:47template parameters
- 24:28print dates
- 27:58merge
- 35:58ranges
- 39:00const express
- 41:05consteval
- 46:43size
- 53:24currentzone
- 55:11range
- 56:44formatter








