Skip to content
academia.sh

Course Advanced

Resource Management and the Standard Library

Published Updated

By the end of this course

Start course

01

Ownership and Move Semantics

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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

The Standard Library

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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.
  7. 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 typing to search.

↑↓ ↵ Esc navigate · open · close