academia.sh
/
C and C++
/
Resource Management and the Standard Library
Course
Advanced
Resource Management and the Standard Library
Published
September 24, 2026
·
Updated
September 26, 2026
By the end of this course
Expresses ownership semantics in the type with smart pointers
Explains how move semantics removes the cost of a copy
Chooses containers and algorithms with the right complexity
Tells whether an operation leaves the source unchanged, changes it, empties it or leaves it in an unspecified state, and measures it
Recognizes the places where a moved-from object and an invalid iterator may only be given a new value
01
Smart pointers, move semantics and rvalue references, the rule of zero and the rule of five, non-copyable and non-movable types — each paired with the question of what an operation leaves in the source.
01
Smart Pointers
Naming what an operation leaves in the source after it runs on a unique_ptr, shared_ptr, or weak_ptr with four kinds: unchanged, changed, empty, unspecified.
02
Move Semantics
std::move is nothing but a type conversion; the actual move is done by the move constructor and the move assignment operator. Measuring what is left in the source after a std::string is moved.
03
The Rule of Zero and the Rule of Five
How writing a destructor suppresses the implicit move constructor, how the five special member functions depend on one another, and how the rule of zero reaches the same result without ever forming that dependency.
04
Non-Copyable and Non-Movable Types
Using = delete to forbid copying, moving, or both on a class; a resource emptying by a promise that comes from the class itself, not the standard.
02
Containers, iterators and their validity rules, algorithms, the erase–remove idiom, lambdas, ranges and type deduction — each paired with the question of what an operation leaves in the source.
01
Containers
The measurement of how a map's operator[] read inserts an element when the key is absent, and how find and contains leave the source unchanged.
02
Iterators and Validity
The measurement of how reading an iterator after erase enters undefined behavior, and how an iterator that stays valid remains unchanged.
03
Algorithms
The measurement of how std::sort changes a vector in place, and how read-only algorithms such as std::count leave the source unchanged.
04
The Erase–Remove Idiom
The measurement of how the elements left in a vector's tail after std::remove carry an unspecified value, and how erase actually removes that tail.
05
Lambdas and Function Objects
The measurement of how a lambda's non-mutable capture-by-value leaves the source unchanged, and how the captured copy stays independent across calls.
06
Ranges
The measurement of how a view constructed from an lvalue leaves the underlying container unchanged, and how a view chain is evaluated lazily.
07
Type Deduction
How auto drops const and reference, auto&/const auto&/auto&&, decltype and decltype(auto), the copy-versus-reference difference in structured bindings, and what type deduction leaves in the source.
Final exam
Resource Management and the Standard Library — Final Exam
In preparation
This course's question bank is not complete yet. The exam opens here automatically once enough questions are added.
Start the exam
↑↓
↵
Esc
navigate · open · close