C++ tutorial
Build fast applications with modern types and classes.
Course contents
Programming fundamentals
C++ Basics
Write and run a first program.
C++ conditions and range loops
Filter a sequence while accumulating a result.
C++ functions and references
Use a reference parameter to update a caller's value.
C++ recursive factorial
Trace recursive calls and their return values.
C++ strings and string streams
Use std::string, parse text with getline and istringstream, and convert between text and numbers.
C++ references, const, and auto
Pass large objects without copying, protect them with const, and let the compiler deduce types.
C++ lambdas and the standard algorithms
Sort, search, count, transform, and remove elements with algorithms and small anonymous functions.
Object-oriented programming
C++ Classes
Group data and behavior.
C++ constructors and encapsulation
Initialize private state and expose a controlled interface.
C++ abstract classes and virtual dispatch
Invoke derived behavior through a base reference.
C++ composition and RAII
Let owned members manage their resources automatically.
C++ function templates
Reuse one type-checked algorithm for different types.
C++ inheritance and virtual functions
Call the right method through a base-class pointer, and see what slicing does.
C++ operator overloading
Give a Vec2 class natural arithmetic, comparison, and output operators.
C++ smart pointers and ownership
Use unique_ptr for single ownership, shared_ptr for shared ownership, and weak_ptr to observe.
Data structures and algorithms
C++ vectors and iterator invalidation
Grow a dynamic array and use checked access.
C++ binary search with lower_bound
Find an insertion position and check whether it is a match.
C++ stack and queue adapters
Compare LIFO and FIFO removal on the same values.
C++ ordered maps and frequencies
Count keys and traverse them in sorted order.
C++ linked lists with unique ownership
Build a node chain with automatic destruction.
C++ sorting: insertion sort, merge sort, and std::stable_sort
Write two sorts by hand and sort records with a comparator, keeping equal items in order.
C++ singly linked list with unique_ptr
Own each node with a unique_ptr, push at the front, reverse the list, and let destructors do the cleanup.
C++ binary search tree traversals
Insert values into a BST and visit them depth-first and level by level.
C++ priority_queue and the top-k pattern
Use a binary heap to get the smallest element quickly, and keep the k largest values of a stream.
C++ graphs: BFS, DFS, and connected components
Store a graph as adjacency lists, visit it breadth-first and depth-first, and count its components.