Skip to content

User-Defined Literals

User-defined literals (UDLs) let you assign custom semantics to literal values — 100_m means 100 meters, 1.5_rad means radians, and "hello"sv means string_view. Combined with constexpr and strong types, UDLs can perform unit checking and type conversions at compile time, making them a powerful tool for implementing type-safe physical unit libraries.

Chapter Contents

v0.7.1-1-gb1e27bb · b1e27bb · 2026-07-05