Skip to content

Overview

Welcome to the mp-units examples collection! These practical, runnable examples demonstrate how to use the library in real-world scenarios, from simple introductory programs to advanced domain-specific applications.

All examples are designed to work with all supported compilers and use the Wide Compatibility mode to ensure maximum portability.

How to Use This Section

Examples are organized by complexity and tagged by features, systems, and application domains to help you find exactly what you need:

Learning Path

  • Beginner Examples (Level - Beginner): Start here if you're new to mp-units. These examples provide detailed, line-by-line explanations of library fundamentals\ including how to structure your code, which headers to include, and which namespaces to use.

  • Intermediate Examples (Level - Intermediate): Once you understand the basics, explore these examples that demonstrate specific features in depth. They skip repetitive boilerplate explanations and focus on the unique value each example provides.

  • Advanced Examples (Level - Advanced): Complex, real-world applications showing how mp-units solves challenging problems in specialized domains.

Finding Examples by Interest

Use the tag system below to jump directly to examples matching your interests:

  • By System: Find examples using specific unit systems (SI, CGS, Imperial, etc.)
  • By Feature: Discover examples demonstrating particular library capabilities (conversions, affine space, mathematical operations, etc.)
  • By Domain: Locate examples relevant to your field (embedded systems, electronics, physics, aerospace, etc.)

You can explore examples sequentially in the documentation order, or use tags to create your own learning path based on your specific needs.

Tags

Domain - Electronics

Domain - Embedded

Domain - Engineering

Domain - Finance

Domain - Mechanics

Domain - Metrology

Domain - Physics

Feature - Affine Space

Feature - Auto Prefix Selection

Feature - Custom Dimensions

Feature - Custom Quantities

Feature - Custom Representation

Feature - Custom Units

Feature - Exponential Functions

Feature - Faster-Than-Lightspeed Constants

Feature - Mathematical Operations

Feature - Multi-System Units

Feature - Physical Constants

Feature - Quantity Concepts

Feature - Representation Types

Feature - Runtime Conversion Functions

Feature - Text Formatting

Feature - Unit Conversions

Feature - Value Truncation

Feature - Volatile Quantities

Level - Beginner

Level - Intermediate

System - CGS

System - ISQ

System - Imperial

System - International System

System - SI

System - Strong Angular