C++ / a working model

BOOK / SOURCE & READING RECORD

Accelerated C++: Practical Programming by Example

Andrew Koenig; Barbara E. Moo

2000年第1版,second printing November 2000;公开PDF为412页重新排版副本

READING EVIDENCE / Full text read

Accelerated C++: Practical Programming by Example

Chapters 0–16 and Appendices A and B have been read continuously for all available body text, code, Details, and exercises. In addition, the 24 substantial figures in the PDF have been read directly, covering median, erase/partition, pointers, copying, reference counting, and the picture inheritance diagrams; extraction completion is not counted as reading. The complete scope refers to this public second-printing copy and does not include separately attached exercise solutions; exercises were not executed. Occasional transcriptions and errors from early printings retain errata notes.

Edition, actual reading range, and original sources →

Sources

Let requirements drive abstraction, rather than first memorizing language parts

§5.3 Using iterators instead of indices; §6.3 Classifying students, revisited; Chapters 11–15 resource types and handles

This book first lets the reader complete visible tasks with string, vector, and algorithms, then explains how to construct resource types. Student classification runs through several implementations; what changes is not the meaning of “the student passed,” but whether the input is retained, when iterators are invalidated, and how many times elements are moved. remove_if especially reveals the boundary between algorithms and containers: it can overwrite existing elements but does not own the container's size; erase is what ends the lifetime of the trailing elements. A modern tutorial can replace old adapters with lambdas, but cannot omit this layer of contract. The later Vec, handle, and picture-inheritance material continues to answer questions of representation and ownership; it is suitable for analyzing responsibilities but is not a production implementation that should be copied directly. Exception paths and polymorphic deletion still require independent review.

Related fundamentals

Algorithms: sort, boundary search, and erase-removeIterators: capability categories, ranges, and validityRAII: Give Cleanup Responsibility to Objects

Original practice →