~/talk

Embracing Trailing Return Types and `auto` Return SAFELY in Modern C++

Talkat CppCon 2022 · 2022-09-11..09-16· [rust]
slides:none on file

Compares trailing-return syntax vs omitted/auto return with concrete code: uses decltype(auto) to preserve value category, shows a units library and half_interval that compile and behave as expected, builds add_in returning a lambda and a thread_safe_invoke wrapper using mutexes and perfect forwarding, and demonstrates overload/substitution-failure differences that bite during refactoring. Enumerates restrictions (no virtual, no initializer_list, recursion/order sensitivity) and prescribes documentation, short functions, or explicit return types where deduction breaks insulation.

AI-written summary · about

  1. 0:00Introduction
  2. 2:30Trailing Return Types
  3. 8:32Decotype
  4. 11:38Use Cases
  5. 16:05Auto Return
  6. 20:25Template parameter type deduction
  7. 26:21Conversion operator
  8. 28:50Syntax limitations
  9. 30:37Decotype Auto
  10. 32:36Decorating Auto
  11. 37:48Half Interval
  12. 41:01Mutex Lock
  13. 43:03Pitfalls
  14. 44:39Documentation
  15. 49:08Mitigation Strategy
  16. 50:29recursive factorial
  17. 51:22two different templates
  18. 52:25you get the fallback
  19. 54:48use it with caution
  20. 55:28Questions
~/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.