~/talk

Back to Basics: Initialization in C++

name:Ben Saks
links:none on file
slides:none on file

Explains exactly which constructor each form invokes using concrete examples like T t1(1,2,3) T t2{4,5,6} T t3 = t2 and demonstrates where the compiler chooses differently, the parsing trap of the most vexing parse, and when copy elision or value initialization applies. Compares direct vs copy initialization, shows how brace initialization prohibits narrowing, explores initializer_list overload resolution and how make_unique and C++20 aggregate changes actually behave.

AI-written summary · about

  1. 0:00Welcome
  2. 0:27Initialization complexity in C++
  3. 1:54C inheritance rules
  4. 3:43Aggregate initialization
  5. 7:14Class types and constructors
  6. 10:03Aggregates and constructors
  7. 12:12Direct initialization
  8. 14:22Copy vs assignment
  9. 17:56Copy initialization
  10. 20:05Mixed mode aggregates
  11. 21:10Implicit conversions
  12. 24:04Default initialization
  13. 26:32Most vexing parse
  14. 28:17Value initialization
  15. 32:19C++03 initialization problems
  16. 38:32Uniform initialization
  17. 41:24Direct list initialization
  18. 43:14Copy list initialization
  19. 45:23Narrowing conversions
  20. 48:59Initializer lists for STL
  21. 51:31Empty brace initialization
  22. 53:15Constructor overload with braces
  23. 55:46Risks of initializer lists
  24. 57:54Template initialization pitfalls
  25. 1:00:28C++20 aggregate improvements
  26. 1:01:10Key takeaways
~/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.