Part 2
Memory and objects
The part of C++ that other languages hide from you. Everything from here on — copies, moves, containers, performance — is a consequence of what is in this part.
-
2.1
Objects and storage
What a variable actually is: a named region of bytes with a type stamped on it.
-
2.2
Pointers
An address in a variable, and every consequence that follows.
-
2.3
References
Another name for an existing object, and how that differs from a pointer.
-
2.4
Lifetime and scope
When an object starts existing, when it stops, and what touching it outside that window costs.
-
2.5
The stack and the heap
Two ways to get memory, with very different costs and rules.
-
2.6
Arrays, and why they decay
The oldest container in the language, and the surprising rule that makes it lose its size.
-
2.7
const and constness
A promise to the compiler and to the reader, enforced at compile time.