Summary
Jason explores C++11's user-defined literals feature, explaining their constraints and best practices. User-defined literals must accept specific parameter types (unsigned long long, long double, const char*, etc.), must be prefixed with an underscore (non-underscored suffixes are reserved for the standard library), and should almost always be marked consteval to ensure compile-time evaluation. The episode demonstrates creating a kibibyte literal (_KiB) and emphasizes that user-defined literals should return strongly-typed objects rather than built-in types for better type safety.
Related C++ Standard Sections
This episode covers topics found in these sections of the C++ standard:
-
[lex.ext]46% match -
[diff.dcl]46% match