A C++ Approach to Physical Units
summary
A C++20 header-only library implements dimensional analysis with compile-time safety and no runtime overhead, using concepts, class types as non-type template parameters, CRTP strong typedefs and a quantity type distinct from std::chrono::duration. It avoids std::ratio limits by planning larger integer support, uses make_dimension and democratic traits to normalize exponent lists, and emits clearer diagnostics than Boost.Units. Requires a recent compiler (GCC 9.1+ for experimentals); source and examples are on GitHub.
AI-written summary · about
chapters (28)
- 0:00Introduction and speaker background
- 0:53Mars Climate Orbiter disaster
- 3:24Personal motivation for physical units
- 6:36Challenges with current unit handling
- 8:42SI units and dimensional analysis basics
- 11:52Current libraries overview
- 13:16Boost.Units deep dive
- 17:53Boost.Units usage example
- 18:35Boost.Units benefits and drawbacks
- 19:40Nico Josuttis' library review
- 21:52Unit design philosophy
- 22:35User experience issues with libraries
- 27:16Template metaprogramming challenges
- 32:54Proposed library design principles
- 34:38C++20 concepts and user experience
- 36:47Performance and type safety
- 38:16Library architecture overview
- 41:02Unit and dimension creation
- 43:13Quantity operations and temperature
- 44:15Quantity interface and strong types
- 47:18Strong types and inheritance
- 49:03Derived quantity classes
- 50:33Concepts in the proposed library
- 51:57Debugging and compiler support
- 53:20Contracts and future standards
- 54:47Extending with custom units
- 56:56Next steps and standardization
- 59:06Q&A session
related talks
01h 02mA Physical Units Library For C++
01h 31mImproving Our Safety With a Modern C++ Quantities and Units Library
01h 09m“Boost Units Library for Correct Code"
58mSimplify and Secure Equation Systems with Type-Driven Development
41m“Avoiding Disasters with Strongly Typed C++”
58mSoftware Engineering Is About Tradeoffs
21mSafe Numerics Library
59mThe Most Average Function There Is
