Follow me on Twitter: / codemastercppyt
This video covers the reasoning behind why structs and classes can take more memory than you think, how to avoid it and different trade-offs regarding it by explaining how memory is accessed, cache lines, and alignment.
My profiles:
Join my discord: / discord
Github: https://github.com/prince776
Linkedin: / prince776
Codeforces: https://codeforces.com/profile/codema...
Codechef: https://www.codechef.com/users/codema...
Atcoder: https://atcoder.jp/users/codemastercpp
Timestamps:
0:00 Intro
1:26 How memory access works
9:57 Memory Alignment
15:13 The long double Anomaly
18:00 Alignment for structs
28:10 How to fix it
29:50 Packed struct
30:14 Array of Structs and Struct of Arrays
31:58 Summary
#memoryalignment #cpp #programming #struct #classes #oops