~/talk

“Variants: Past, Present, and Future"

Talkat CppCon 2016 · 2016-09-18..09-23· [compilers-and-language-design]
linkedin:david-sankel
slides:none on file

History and practical details: Boost.Variant (2004) implements sum types with hidden heap allocation on assignment and a make_recursive_variant helper; extraction uses boost::get or visitors. The standard update as std::variant (C++17) adds visit, get_if, index-based access, removes special recursion support and resolves the assignment exception problem with the valueless_by_exception compromise (never-empty vs explicit-empty debate). Also shows manual recursive patterns using shared_ptr, available third-party implementations, and an in-progress language-level variant + pattern-matching draft with extractors.

AI-written summary · about

  1. 0:00Introduction
  2. 0:32Past Present Future
  3. 1:17Motivation Examples
  4. 1:53Undefined Behavior
  5. 2:21Problems with this approach
  6. 2:50Abstract base classes
  7. 5:34More boilerplate
  8. 6:04Recursive
  9. 6:32Variant
  10. 7:09Person ID
  11. 7:33Commands
  12. 8:10Variants
  13. 8:48Variant vs Inheritance
  14. 10:04Boost Variant
  15. 13:26What did we learn
  16. 14:35Inheritance
  17. 15:09Unwrap
  18. 15:38Recursive Variant
  19. 16:46Direct Recursion
  20. 17:54Assignment Problem
  21. 20:03Standed Variant
  22. 20:34Visit Variant
  23. 21:02Get Reworked
  24. 21:29Get Using an Index
  25. 21:52Duplicate Entries
  26. 22:15Recursion Support
  27. 22:32Standem Mono States
  28. 23:36Empty Variant
  29. 25:55Valueless by Exception
  30. 28:03Incremental Improvements
  31. 28:24Questions
  32. 29:45Language Support
  33. 30:05JSON Variant
  34. 30:53Basic Pattern Matching
  35. 31:21LanguageBased Variants
  36. 31:49IndexBased Variants
  37. 32:10TypeBased Variants
  38. 34:35Stud Variants
  39. 34:54Problems with Variants
  40. 35:33Variant Pattern Matching
  41. 36:16Pattern Matching onstructs
  42. 36:31Pattern Matching on fields
  43. 37:46Standover function
  44. 38:33Visitors with extra arguments
  45. 40:13Questions comments insults
  46. 40:47Questions comments
  47. 44:51Syntax
  48. 45:49Pattern Matching
  49. 47:15Implementation Requirements
  50. 49:12Nested Pattern Matching
  51. 50:52Language Based Matching
  52. 52:25The Ordering Matters
  53. 53:29MatchAll
  54. 54:12Optional
~/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.