Skip to content

2026

Range-Validated Quantity Points

Physical units libraries are good at preventing dimensional errors and unit mismatches. They have not addressed a different category of correctness: domain constraints on quantity point values.

A latitude is not just a length divided by a radius. It is a value that lives in \([-90°, +90°]\), and anything outside that range is physically meaningless. An angle used in bearing navigation wraps cyclically around a circle, and treating it as an unbounded real number ignores a fundamental property of the domain. A clinical body-temperature sensor should reject a reading of \(44\ \mathrm{°C}\) at the API boundary rather than silently pass it downstream.

Type-level constraint enforcement for quantity points with this level of flexibility is a relatively unexplored area in mainstream physical units libraries. The approach described here is experimental, and there are certainly edge cases and design considerations we have not discovered yet.

Report from the Croydon 2026 ISO C++ Committee meeting

It has been 1.5 years since the last major update on the ISO C++ standardization progress here. It is not that I got lazy 😉, but there was really not much to share.

This time, things were different. We achieved a nearly unprecedented success. Probably not many people expected it, and I definitely did not! 🎉

Understanding Safety Levels in Physical Units Libraries

Physical quantities and units libraries exist primarily to prevent errors at compile time. Some of them focus only on dimensional analysis and unit conversions. Others go further and prevent representation errors, semantic misuse of same-dimension quantities, and even errors in the mathematical structure of equations.

This article describes six safety levels that a quantities and units library can provide, with examples for each of them. Then it compares how leading C++ libraries and units libraries from other languages score across those levels, together with their performance and memory costs.

Two of the upper levels are the focus here. Quantity kind safety distinguishes dimensionally equivalent concepts such as work vs. torque, or Hz vs. Bq. Quantity safety enforces correct quantity hierarchies and scalar/vector/tensor mathematical rules. Both are well-established concepts in metrology and physics, and both remain widely overlooked in the C++ ecosystem. They go well beyond dimensional analysis and prevent subtle semantic errors that unit conversions alone cannot catch.

New Systems Documentation Generator

The mp-units documentation now has an automated systems reference generator. It extracts all quantities, units, dimensions, and their relationships directly from the library's C++ source code and documents them.