~/talk

constexpr: Applications

Talkat CppCon 2015 · 2015-09-21..09-25· [compilers-and-language-design]
links:none on file
slides:none on file

Shows how to implement a constexpr binary literal in C++11 via recursive constexpr parsing and static_asserts, and how C++14 replaces recursion with a cleaner nonrecursive version. Demonstrates compile-time tables: a generated sine table, a compile-time insertion sort plus static validation, a sorted-array associative lookup using equal_range, and a tiny perfect hash for four strings. Notes limits (recommended recursion depth ~512, >1,000,000 full-expressions), clang/GCC C++14 support, Visual Studio gaps, and a unresolved extern hack that forces compile-time evaluation for constexpr containers but is compiler/linker dependent.

AI-written summary · about

  1. 0:00Intro
  2. 2:08constexpr Contexts
  3. 2:41constexpr Values
  4. 3:30constexpr Computations
  5. 7:28Using constexpr11_bin
  6. 8:40constexpr 14 bin
  7. 9:27constexpr Limits
  8. 11:29User Errors at Compile Time
  9. 15:23User Errors At Runtime
  10. 15:44Runtime Execution?
  11. 18:19Guidance
  12. 22:45Technique Summary
  13. 23:06Compile-Time Parsing Summary
  14. 24:26Motivation
  15. 26:29First constexpr Array
  16. 28:11Returning a constexpr Array
  17. 33:22Non-const constexpr Methods
  18. 34:50generate sine
  19. 38:01Try generate_sine
  20. 41:54Test constexpr_to_upper
  21. 44:56Test constexpr_is_alphabetical
  22. 50:36Test constexpr_str_sort
  23. 51:51Compile-Time Associative Containers
  24. 53:14constexpr Unordered Containers?
  25. 56:18Perfect Minimal Hash Function
  26. 56:54constexpr Container Downsides
  27. 57:42constexpr Container Summary
  28. 58:33Topics
~/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.