Start here¶
Level: 101 · for programmers new to C++
One line: You need one C++20 compiler, one command to build a file, and the difference between the three kinds of evidence a page here can show you.
What this library assumes¶
That you already program — in Python, Rust, ABAP or anything else — and want to know what C++ actually does, measured rather than asserted. The first chapter needs no C++ beyond these pieces of syntax, which it uses without stopping to explain:
| You will see | It means |
|---|---|
namespace sc = std::chrono; |
a short alias for a long namespace — the talk's slides use exactly this one, and hide the line |
auto t = f(); |
the compiler works out the type; the type still exists, and it matters |
using rep = long long; |
a type alias, here inside a struct |
std::chrono::duration<long long, std::milli> |
a template: a type built from other types and numbers, in angle brackets |
requires(A a, B b) { a - b; } |
C++20: a compile-time question — would this compile? — answered true or false |
1500ms, 2s |
duration literals, from using namespace std::chrono_literals; |
Compile one example yourself¶
On macOS, c++ is Apple clang and uses libc++; on Linux it is usually GCC and uses libstdc++. Check which you have:
Every example is a single file, so building one is one command:
c++ -std=c++20 -O2 01_Time_and_Benchmarking/three_clocks/examples/three_clocks.cpp -o three_clocks
./three_clocks
Three kinds of evidence¶
A page can show you three different things, and each is labelled so you can tell them apart:
- A generated output block — Verified output of … held to the same answer key on libstdc++ and libc++ in CI. The strongest claim here: this is what the standard makes every conforming library print.
- A dated fence — Measured 2026-09-10 on … — not an answer key. True on the machine it names. Everything a vendor or a CPU decides has to live in one: timings, which clock
high_resolution_clockis, assembly. - A compiler transcript — the error that code which does not compile produces, titled with the compiler that produced it. GCC and Clang word the same refusal differently, so a transcript is a quotation, never a key.
If you already know Rust¶
Every lesson in the first chapter links its twin in the Rust library ↗, which makes the same point with Rust's types — and sometimes makes a stricter one.
Where to start¶
Time and benchmarking, beginning with Three clocks.