By Mateusz Pusz
This lecture presents how Modern C++ features enable 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 C20 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 C20 and some C23 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.