Tutorials¶
Welcome to the mp-units tutorials — your step-by-step guide to mastering type-safe physical quantities and units in C++.
Each lesson is:
- Exercise-driven: Learn by doing, with real-world scenarios and hands-on code.
- Type-safe: Avoid common bugs by leveraging strong types and modern C++ features.
- Interactive: Try code snippets live via Compiler Explorer embeds.
- Incremental: Progress from basic refactoring to advanced topics like affine spaces
and
std::chronointerop.
Whether you're new to physical units in C++ or looking to deepen your expertise, these practical, type-safe patterns will help you apply mp-units in real projects.
Learning Path¶
- Refactor to Strong Types
- Refactor to Generic, Type-Safe Interfaces
- Extracting Numeric Values
- Working with Temperatures
- Affine Spaces and Reference Origins
- Interop with
std::chrono - Custom Units for Dimensionless Counters
- Typed Quantities of the Same Kind
- Custom Quantity Specifications
- Custom Base Dimensions