Skip to content

User-Defined Literals ​

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

Chapter Contents ​

pdf-latest-4-g85128cc · 85128cc · 2026-10-05