Functions, references and containers
This part of the C++ course is about the values a function takes and the containers that keep them. A reference and const correctness come first, then overloading and recursion, the namespace, and the lifetime of a variable. The standard library follows: std::string and std::vector, a fixed-size std::array and a view over them, the type deduction that saves a name, an enumeration, and the bits of an integer with std::bitset.
011
References
a reference as another name for an object, references as parameters, and when a copy is the better choice
Open
012
const and const correctness
const variables, const references, pointers to const, const members of an API and constexpr values
Open
013
Overloading and default arguments
overload resolution on parameter types, default arguments, ambiguities and the errors they print
Open
014
Recursion
a base case, a recursive step, factorials, the call stack, and a recursion that runs out of stack
Open
015
Namespaces
declaring a namespace, qualified names, using declarations, nested namespaces and the anonymous namespace
Open
016
Scope and lifetime
block scope, static local variables, global objects, thread_local and the order of destruction
Open
017
std::string
construct, append, find, substr, compare, convert numbers and walk the characters of a string
Open
018
std::string_view
a view over existing characters, substr without copying, dangling views and when to pass a view
Open
019
std::vector
size and capacity, push_back, reserve, indexing, erase and the cost of growing
Open
020
std::array, C arrays and std::span
fixed-size arrays on the stack, std::array as a value type, and std::span for a read-only window
Open
021
auto, decltype and structured bindings
type deduction, the difference between auto and auto&, decltype and unpacking pairs and structs
Open
022
Enumerations
unscoped enums, enum class, underlying types, switch over an enum and printing a name
Open
023
Bits, bit fields and std::bitset
bitwise operators as flags, shifts, std::bitset, bit fields in a struct and their layout
Open