P3045R7 — Quantities and units library (26 items) SG6, SG16, LEWGI
Mateusz Pusz, Dominik Berner, Johel Ernesto Guerrero Peña, Chip Hogg, Nicolas Holthaus, Roth Michaels, Vincent Reverdy
This paper proposes a type-safe, zero-overhead C++ standard library for physical quantities and units, based on the mp-units library and consolidated from earlier proposals P2980R1, P2981R1, and P2982R1. It defines a generic framework including dimensions, quantity specifications, units, quantity and quantity_point class templates, affine space abstractions, symbolic expression simplification, and text formatting facilities. The proposal emphasizes compile-time safety through quantity kinds, unit conversions, truncation prevention, and overflow detection, while supporting extensibility for user-defined systems of quantities and units.

References — Anthropic Citations API

[1]
"Document #: P3045R6"
[2]
"constexpr auto step_delta = delta>(0.5);"
[3]
"point(5) results with a quantity."
[4]
"point(5) results with a quantity."
[5]
"inline constexpr struct DottedEighthNote final : std::named_unit<"q.", std::mag<3> * SixteenthNote> {} DottedEighthNote;"
[6]
"u8"030""
[7]
"std::println("qp2: {::N[:.2f]}, {}, {}","
[8]
"fmt::println("qp1: {}, {}, {}","
[9]
"The should be no runtime overhead"
[10]
"It is fully generic and allow defining any system abstraction on top of it."
[11]
"After consulting with the LEWGI in St. Lois"
[12]
"we also heve a x.force_numerical_value_in(u)"
[13]
"Here are a few possbile alternatives:"
[14]
"the above outputs are a bit artifical"
[15]
"in case a value of a numerator or denumerator is greater or equal 1000"
[16]
"which may look suprising"
[17]
"However, a few aternatives are possible:"
[18]
"Depending on the desired semanthics of equivalent function"
[19]
"x.coerse_in(u), x.coerse_numerical_value_in(u),"
[20]
"is not provided in ISO or BIPM metrology dictonaries"
[21]
"a reader is expected to be familar with them already"
[22]
"This prevents the users to derive own strong types from them"
Summary: P3045R7 proposes a comprehensive quantities and units library for the C++ standard, covering dimensional analysis, unit conversions, quantity points, formatting, and extensibility for user-defined systems. The paper provides design rationale, API surface, and extensive usage examples across physical and non-physical domains.
Pipeline: Discovery (Anthropic Opus + Citations API) → Verification Gate (OpenRouter Opus) → Report Writer (OpenRouter Opus)
Provenance: All references are machine-verified character positions from the Anthropic Citations API — deterministic, exact substrings, not model-generated quotes.