User-Defined Literals: Raw and Cooked
Explore how Modern C++ supports user-defined literals, including raw and cooked forms, for various data types like characters, strings, integers, and floating points. Understand how these literals enhance type safety and initialization in embedded and safety-critical system programming, preparing you to implement custom literal operators effectively.
We'll cover the following...
We'll cover the following...
The Four User-Defined Literals
C++11 has user-defined literals for characters, C strings, integers, and floating point numbers. For integers and floating point numbers, they are available in raw and cooked form. Due to C++14, we have built-in literals for binary numbers, C++ strings, complex numbers, and time units.
To clarify, below are the raw and cooked variations of the literal types.
...