A Physical Units Library For C++
summary
mp-units is a C++20 library (GitHub, Conan, Godbolt, Gitpod) that encodes quantities, units, dimensions and prefixed SI units with concepts and NTTPs, eliminating macros. It claims zero runtime overhead versus raw doubles and often compiles to fewer ops (one division vs multiple divides in naïve code). It provides quantity_cast, nice debugger/type names via a "doncasting" facility, integrates with linear-algebra proposals, supports GCC10+/Clang/MSVC and is already used in production (≈100+ companies).
AI-written summary · about
chapters (34)
- 0:00Introduction
- 1:48Agenda
- 5:32Results
- 9:39Example
- 10:25Doubles
- 11:27Boost Units
- 12:21Implicit Conversion
- 13:33Labor
- 14:53Use Case
- 15:57Return Type
- 16:39NYX Library
- 17:12Concepts
- 17:40Interfaces
- 17:51Generic Code
- 19:15Performance
- 20:12Overhead
- 20:36User Experience
- 23:48Dimension Mismatch
- 24:45Doncaster Facility
- 26:19Debugging Experience
- 27:38Strong interfaces
- 29:23Unit concepts
- 35:53Universal template parameter
- 37:31Conversions
- 38:34Meta Programming Tricks
- 39:36Benefits of Using Concepts
- 40:40Defining New Units
- 42:26Converting to Ratio
- 43:09New Use Cases
- 43:59Streams
- 44:32Official Definition
- 46:17Next Steps
- 51:18Github
- 52:55Users
related talks
01h 08mA Physical Units Library For the Next C++
01h 23mThe Power of C++ Templates With mp-units: Lessons Learned & a New Library Design
01h 31mImplementing Physical Units Library for C++
01h 31mImproving Our Safety With a Modern C++ Quantities and Units Library
01h 30mEnhancing Safety in C++ Code With Modern C++ Quantities and Units Library
01h 05mA C++ Approach to Physical Units
01h 03mHow to Improve the Safety of C++ Code With a Quantities & Units Library
01h 09m“Boost Units Library for Correct Code"
