Effective Modern C++ 學習地圖 (MOC)

Overview

《Effective Modern C++》(Scott Meyers)聚焦 C++11 / C++14 的高效使用方式,全書共 42 個 Items,分為 8 章+導論:型別推導、auto、現代慣用法、智慧指標、移動語意與完美轉發、lambda、並行 API 與效能調校。本 vault 將導論整理為 1 篇術語筆記,42 個 Items 各對應 1 篇 concept 筆記(共 43 篇),每個資料夾另附 1 個練習檔。

建議學習順序

  1. 01-Introduction:先統一術語(lvalue/rvalue、exception safety、closure)——全書共用語彙。
  2. 02-Deducing-Types → 03-Auto:型別推導是後續所有章節的地基,Item 1/2/3 必須精熟。
  3. 04-Moving-To-Modern-Cpp:現代慣用法,篇數最多、可分段消化;其中 Item 14(noexcept)與 Item 17(特殊成員函式)是第 5、6 章的前置知識。
  4. 05-Smart-Pointers → 06-Move-Semantics-And-Perfect-Forwarding:所有權與移動語意是本書核心,相依最密集。
  5. 07-Lambda-Expressions → 08-Concurrency-API → 09-Tweaks:應用層主題,大量引用前面章節的推導與移動規則。

每讀完一個資料夾,立即完成該資料夾的練習檔,再用 面試陷阱題 自我檢驗。

Topic Map

Section Source Notes Status
01-Introduction Introduction (pp. 1-8) 術語與慣例 [ ]
02-Deducing-Types Chapter 1 (pp. 9-36) Item 1 模板型別推導Item 2 auto 型別推導Item 3 decltype 規則Item 4 檢視推導型別 [ ]
03-Auto Chapter 2 (pp. 37-48) Item 5 優先使用 autoItem 6 顯式型別初始器慣用法 [ ]
04-Moving-To-Modern-Cpp Chapter 3 (pp. 49-115) Item 7 () 與 {} 初始化Item 8 空指標 nullptrItem 9 別名宣告Item 10 scoped enums 規則Item 11 deleted functions 用法Item 12 override 宣告Item 13 const_iterator 用法Item 14 noexcept 宣告Item 15 constexpr 用法Item 16 const 成員函式執行緒安全Item 17 特殊成員函式生成 [ ]
05-Smart-Pointers Chapter 4 (pp. 117-156) Item 18 unique_ptr 專屬所有權Item 19 shared_ptr 共享所有權Item 20 weak_ptr 用法Item 21 make 函式Item 22 Pimpl Idiom 用法 [ ]
06-Move-Semantics-And-Perfect-Forwarding Chapter 5 (pp. 157-214) Item 23 std::move 與 std::forwardItem 24 universal reference 判定Item 25 move 與 forward 使用時機Item 26 避免對 universal reference 重載Item 27 重載的替代方案Item 28 reference collapsing 規則Item 29 move 操作的現實Item 30 完美轉發失敗案例 [ ]
07-Lambda-Expressions Chapter 6 (pp. 215-239) Item 31 避免預設捕獲模式Item 32 init capture 用法Item 33 auto&& 參數的 decltype 轉發Item 34 lambda 優於 std::bind [ ]
08-Concurrency-API Chapter 7 (pp. 241-280) Item 35 task-based 優先Item 36 std::launch::async 指定Item 37 thread 全路徑 unjoinableItem 38 thread handle 解構行為Item 39 void futures 事件通訊Item 40 atomic 與 volatile [ ]
09-Tweaks Chapter 8 (pp. 281-302) Item 41 考慮值傳遞Item 42 emplacement 用法 [ ]

Practice Notes

資料夾 練習檔 題數 Status
01-Introduction 導論練習 13 [ ]
02-Deducing-Types 型別推導練習 13 [ ]
03-Auto auto 練習 13 [ ]
04-Moving-To-Modern-Cpp 現代慣用法練習 14 [ ]
05-Smart-Pointers 智慧指標練習 14 [ ]
06-Move-Semantics-And-Perfect-Forwarding 移動語意與完美轉發練習 14 [ ]
07-Lambda-Expressions lambda 練習 14 [ ]
08-Concurrency-API 並行 API 練習 14 [ ]
09-Tweaks 效能調校練習 13 [ ]

Study Tools

工具 連結 用途
面試陷阱題 面試陷阱題 彙整全書最易答錯的陷阱情境,考前衝刺與自我檢驗
速查表 速查表 42 Items 的一行結論與關鍵規則對照,快速回憶

Tag Index

Tag Related Topics Level
cpp 全 vault 共通(所有筆記必帶) top
concept 概念筆記(每個 Item 一篇) note-type
practice 練習題檔(每資料夾一個) note-type
dashboard 導覽頁(MOC、速查表) note-type
exam-traps 面試陷阱題頁 note-type
foundations 導論:術語與基礎慣例 domain
lvalue-rvalue value category 判別、parameter 恆為 lvalue detail
exception-safety basic / strong guarantee detail
function-objects function object、closure、callable detail
type-deduction Chapter 1:型別推導 domain
template-type-deduction Item 1:三情境與 decay detail
auto-type-deduction Item 2:auto 推導與 initializer_list 特例 detail
decltype Item 3:decltype 與 decltype(auto) detail
type-diagnostics Item 4:檢視推導型別的工具 detail
auto-keyword Chapter 2:auto 宣告 domain
auto-declaration Item 5:auto 優於顯式型別 detail
proxy-types Item 6:隱形 proxy 與顯式型別初始器 detail
modern-idioms Chapter 3:現代 C++ 慣用法 domain
braced-initialization Item 7:() vs {} 與 initializer_list 劫持 detail
nullptr Item 8:nullptr 優於 0/NULL detail
alias-declaration Item 9:using 別名與 alias template detail
scoped-enum Item 10:enum class detail
deleted-function Item 11:= delete detail
override-final Item 12:override 與 reference qualifiers detail
const-iterator Item 13:cbegin/cend 與泛型 begin/end detail
noexcept Item 14:noexcept 宣告與優化 detail
constexpr Item 15:編譯期常量與雙棲函式 detail
thread-safe-const Item 16:const 成員函式的執行緒安全 detail
special-member-functions Item 17:特殊成員函式生成規則 detail
smart-pointers Chapter 4:智慧指標 domain
unique-ptr Item 18:專屬所有權 detail
shared-ptr Item 19:共享所有權與 control block detail
weak-ptr Item 20:可懸空指標與 lock() detail
make-functions Item 21:make_unique / make_shared detail
pimpl Item 22:Pimpl Idiom detail
move-semantics Chapter 5:移動語意與完美轉發 domain
std-move Item 23:std::move 的本質(cast) detail
std-forward Item 23/25:條件式 cast 與轉發 detail
universal-reference Item 24:universal vs rvalue reference detail
perfect-forwarding Item 25/30:完美轉發與失敗案例 detail
reference-collapsing Item 28:參考摺疊四規則 detail
overload-resolution Item 26/27:universal reference 與重載決議 detail
lambda Chapter 6:lambda 運算式 domain
capture-modes Item 31:預設捕獲模式的危險 detail
init-capture Item 32:C++14 init capture detail
generic-lambda Item 33:auto&& 參數與 decltype 轉發 detail
std-bind Item 34:lambda 優於 std::bind detail
concurrency Chapter 7:並行 API domain
task-based Item 35:task vs thread detail
std-async Item 36:launch policy detail
std-thread Item 37:unjoinable 與 RAII detail
future-promise Item 38/39:future 解構行為與事件通訊 detail
atomic Item 40:std::atomic detail
volatile Item 40:特殊記憶體 detail
optimization Chapter 8:效能調校 domain
pass-by-value Item 41:值傳遞的取捨 detail
emplacement Item 42:emplace 系列函式 detail

Tag rules: 每篇筆記必帶 top-level cpp 與一個 note-type tag(concept / practice / dashboard / exam-traps);detail tag 必須連同其父 domain tag 一起出現(如 noexcept 必伴隨 modern-idiomsshared-ptr 必伴隨 smart-pointers)。

Weak Areas

常見難點自我檢核——勾選前先能不看筆記完整說出規則與例外:

Non-core Topic Policy

來源 PDF 章節 處理 原因
From the Publisher Excluded 非學習內容
Acknowledgments Excluded 非學習內容
Index Excluded 非學習內容
書封宣傳頁 Excluded 非學習內容