~/talk

Embracing User-Defined Literals Safely

Talkat ACCU 2022 · 2022-04-06..04-09· [c-and-cpp]
slides:none on file

Explains concrete rules and tradeoffs for C++ user-defined literals: four forms (cooked, raw, numeric-template, string-template), 12 cooked overloads, and when the compiler versus the library must parse or detect overflow. Gives working examples (temperature, IPv4, base‑3 parser, chrono units), shows pitfalls like negatives are not part of the literal and namespace lookup collisions, and recommends consteval in C++20 to force compile‑time errors. Demonstrates what to build, how it’s parsed, when it fails, and when factory functions or typedefs are safer.

AI-written summary · about

  1. 0:00Intro
  2. 1:20Literal Examples
  3. 3:36Outline
  4. 4:44About me
  5. 6:27Book
  6. 8:49UserDefined Literals
  7. 9:39Why UserDefined Literals
  8. 11:38Common UserDefined Literals
  9. 14:25Other Restrictions
  10. 18:26Factory Functions
  11. 19:30UserDefined Literal
  12. 21:03syntactic sugar
  13. 22:27how to define
  14. 25:47namespaces
  15. 28:43cooked udl operators
  16. 37:39token example
  17. 42:27possible overloads
  18. 42:56cooked literals
  19. 47:48raw udl operators
  20. 51:05base3 udl
  21. 54:16base3 error detection
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.