mp-units: Lessons learned and a new library design - Mateusz Pusz
Channel: Using std::cpp
Date: 2023-05-12

This talk presents how Modern C++ enables exciting features and attractive new design possibilities.

mp-units is a Modern C++ library that provides compile-time dimensional analysis and unit/quantity manipulation. It heavily uses C++20 features like concepts and values of class types used as non-type template parameters (NTTPs). Also, it introduced a new powerful technique called the Downcasting Facility.

During the talk, the library's author will describe the significant challenges with the initial design. He will explain the issues with the Downcasting Facility and why user-defined literals (UDLs) are not a good choice for creating quantities, and what the alternatives are. Mateusz will also describe additional requirements that couldn't be addressed with the previous framework and present how the new design addresses them. We will also see many C++20 and some C++23 features in action :-) In the end, we will discuss potential C++ language features that could be helpful to improve the design of this and similar libraries.