Skip to content

Examples

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.

What are Examples?

Examples bridge the gap between learning and doing, showing complete, working applications that you can study and adapt for your own projects.

These examples:

  • ✅ Show complete, runnable code in real-world scenarios
  • ✅ Demonstrate library features in context
  • ✅ Range from beginner to advanced complexity
  • ✅ Are organized by level, system, feature, and domain
  • ✅ Work with all supported compilers
  • ✅ Use Wide Compatibility mode for maximum portability

Prerequisites: Basic familiarity with mp-units from Tutorials. Beginner examples include detailed explanations; intermediate and advanced examples assume fundamental knowledge.

How to Use This Section?

Learning Path

Follow examples sequentially by complexity level:

  • Beginner - Start here if you're new to mp-units. Detailed, line-by-line explanations of library fundamentals including code structure, headers, and namespaces.

  • Intermediate - Demonstrate specific features in depth. Skip repetitive boilerplate and focus on unique value each example provides.

  • Advanced - Complex, real-world applications showing how mp-units solves challenging problems in specialized domains.

Finding Examples by Tags

Browse the tag index to filter examples by:

  • Level - Beginner, intermediate, or advanced
  • System - SI, CGS, Imperial, Natural, IAU, and more
  • Feature - Conversions, affine space, custom units, generic programming, and more
  • Domain - Physics, electronics, aerospace, embedded systems, and more

When to Use Examples?

Use Examples when you:

  • Want to see complete, working applications
  • Need inspiration for your own projects
  • Want to understand how features work together
  • Are looking for patterns to adapt to your use case
  • Need domain-specific implementation examples

Other Resources

  • Tutorials - Learning-oriented lessons for getting started
  • User's Guide - Explanation-oriented understanding of concepts
  • How-to Guides - Task-oriented solutions to specific problems
  • Workshops - Practice advanced patterns with hands-on exercises
  • Reference - Information-oriented technical descriptions