mp-units: Lessons learned and a new library design

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.





Your Privacy

By clicking "Accept Non-Essential Cookies" you agree ACCU can store non-essential cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

Current Setting: Non-Essential Cookies REJECTED


By clicking "Include Third Party Content" you agree ACCU can forward your IP address to third-party sites (such as YouTube) to enhance the information presented on this site, and that third-party sites may store cookies on your device.

Current Setting: Third Party Content EXCLUDED



Settings can be changed at any time from the Cookie Policy page.