r/wg21
P3045R7 - Quantities and units library LEWG
Posted by u/yet_another_si_hater_irl · 6 hr. ago

Document: P3045R7

Author: Mateusz Pusz, Dominik Berner, Johel Ernesto Guerrero Peña, Charles Hogg, Nicolas Holthaus, Roth Michaels, Vincent Reverdy

Date: 2026-02-23

Audience: SG6, SG16, LEWGI

Canonical copy: wg21.link/p3045r7.

This paper proposes a type-safe quantities and units library for C++, building on ideas from mp-units and earlier P2980–P2982 work. The pitch is compile-time dimensional analysis, quantity points versus bare quantities, formatting hooks that line up with modern C++, and extension points for user-defined systems.

If you have only skimmed the abstract: the design leans on templates and symbolic simplification; the usual r/cpp arguments are whether it stays zero overhead in real builds and whether diagnostics stay approachable when someone adds meters to seconds.

▲ 156 points (91% upvoted) · 6 comments
sorted by: best
u/build_system_victim_2019 203 points 5 hr. ago

great, another paper that will take 10 years to get through LEWG

u/template_wizard_throwaway 72 points 5 hr. ago

compile-time safety through quantity kinds

Sounds amazing until I need three custom systems in one translation unit.

u/async_skeptic_cpp 28 points 4 hr. ago

That is exactly what the extensibility sections are trying to address—whether they succeed is a fair question.

u/embedded_for_20_years 45 points 4 hr. ago

I want this for sensor pipelines but our firmware folks will look at the compile times and nope out.

u/definitely_knows_what_volatile_does 31 points 3 hr. ago

NB: if your codebase still uses macroed unit constants, read the rationale before bikeshedding the spelling of quantity_point.