# C++ Knowledge Graph - Complete Dependency Map ## 🌳 Knowledge Tree Structure This document maps all C++ concepts with their dependencies, prerequisites, and optimal learning order. --- ## Level 1: Foundation Nodes (No Prerequisites) ### 1.1 Development Environment ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Compiler Installation β”‚ β”‚ - GCC/G++ (Linux, MinGW) β”‚ β”‚ - Clang/LLVM (Cross-platform)β”‚ β”‚ - MSVC (Windows) β”‚ β”‚ - Compiler flags & options β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> IDE Setup (VS Code, Visual Studio, CLion, Code::Blocks) β”œβ”€> Build Tools (Make, CMake, Ninja) β”œβ”€> Debugging Tools (gdb, lldb, Visual Studio debugger) └─> Version Control (Git integration) ``` ### 1.2 Basic Syntax & Program Structure ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Hello World Program β”‚ β”‚ - #include directive β”‚ β”‚ - main() function β”‚ β”‚ - std::cout β”‚ β”‚ - Return statement β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Compilation Process (Preprocessor β†’ Compiler β†’ Linker) β”œβ”€> Header Files (.h vs .hpp) β”œβ”€> Source Files (.cpp) └─> Comments (// vs /* */) ``` ### 1.3 Fundamental Data Types ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Primitive Types β”‚ β”‚ - int, short, long, long longβ”‚ β”‚ - float, double, long double β”‚ β”‚ - char, wchar_t, char16_t β”‚ β”‚ - bool β”‚ β”‚ - void β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Type Modifiers (signed, unsigned, const, volatile) β”œβ”€> sizeof Operator β”œβ”€> Type Limits (#include , ) └─> Type Aliases (typedef, using) ``` ### 1.4 Variables & Constants ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Variable Declaration β”‚ β”‚ - Initialization β”‚ β”‚ - Assignment β”‚ β”‚ - Scope (local, global) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> const Variables β”œβ”€> constexpr (C++11) β”œβ”€> Literal Constants β”œβ”€> #define Preprocessor Constants └─> auto Type Deduction (C++11) ``` ### 1.5 Operators ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Arithmetic Operators β”‚ β”‚ Relational Operators β”‚ β”‚ Logical Operators β”‚ β”‚ Bitwise Operators β”‚ β”‚ Assignment Operators β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Operator Precedence β”œβ”€> sizeof Operator β”œβ”€> Ternary Operator (?:) β”œβ”€> Comma Operator └─> Type Casting Operators ``` --- ## Level 2: Control Flow (Requires Level 1) ### 2.1 Conditional Statements ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ if Statement β”‚ β”‚ if-else Statement β”‚ β”‚ if-else if-else β”‚ β”‚ Nested if β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> switch Statement β”œβ”€> case Labels β”œβ”€> default Case β”œβ”€> break in switch └─> Ternary Operator Alternative ``` ### 2.2 Loops ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ while Loop β”‚ β”‚ do-while Loop β”‚ β”‚ for Loop β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Range-based for Loop (C++11) β”œβ”€> Nested Loops β”œβ”€> Loop Control (break, continue) β”œβ”€> goto Statement (discouraged) └─> Infinite Loops ``` --- ## Level 3: Functions (Requires Level 1-2) ### 3.1 Function Basics ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Function Declaration β”‚ β”‚ Function Definition β”‚ β”‚ Function Call β”‚ β”‚ Return Statement β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Parameters & Arguments β”œβ”€> Pass by Value β”œβ”€> Default Parameters β”œβ”€> void Functions └─> Function Prototypes ``` ### 3.2 Advanced Function Concepts ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Function Overloading β”‚ β”‚ Inline Functions β”‚ β”‚ Recursion β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> constexpr Functions (C++11) β”œβ”€> consteval Functions (C++20) β”œβ”€> [[nodiscard]] Attribute (C++17) └─> Trailing Return Types (C++11) ``` --- ## Level 4: Arrays & Strings (Requires Level 1-3) ### 4.1 Arrays ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ C-style Arrays β”‚ β”‚ - Declaration & Init β”‚ β”‚ - Array Indexing β”‚ β”‚ - Multi-dimensional Arrays β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Array Decay to Pointer β”œβ”€> Array Size Calculation β”œβ”€> std::array (C++11) └─> Array Initialization Syntax ``` ### 4.2 Strings ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ C-style Strings β”‚ β”‚ - char arrays β”‚ β”‚ - String literals β”‚ β”‚ - String manipulation β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> std::string Class β”œβ”€> String Operations β”œβ”€> std::string_view (C++17) β”œβ”€> Raw String Literals (C++11) └─> User-defined Literals (C++11) ``` --- ## Level 5: Pointers & References (Requires Level 1-4) ### 5.1 Pointers ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Pointer Basics β”‚ β”‚ - Address-of Operator (&) β”‚ β”‚ - Dereference Operator (*) β”‚ β”‚ - nullptr (C++11) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Pointer Arithmetic β”œβ”€> Pointers and Arrays β”œβ”€> Pointer to Pointer β”œβ”€> void Pointers β”œβ”€> const Pointers β”œβ”€> Function Pointers └─> Pointer Best Practices β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Dynamic Memory β”‚ β”‚ - new Operator β”‚ β”‚ - delete Operator β”‚ β”‚ - new[] & delete[] β”‚ β”‚ - Memory Leaks β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Placement new β”œβ”€> Memory Allocation Failures β”œβ”€> std::nothrow └─> RAII Principle ``` ### 5.2 References ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Reference Basics β”‚ β”‚ - Declaration & Init β”‚ β”‚ - References vs Pointers β”‚ β”‚ - const References β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Pass by Reference β”œβ”€> Return by Reference β”œβ”€> Reference Members β”œβ”€> rvalue References (C++11) └─> Universal References β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Pass by Reference β”‚ β”‚ Pass by Value β”‚ β”‚ Pass by Pointer β”‚ β”‚ When to Use Which β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## Level 6: Object-Oriented Programming (Requires Level 1-5) ### 6.1 Classes & Objects ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Class Definition β”‚ β”‚ - Data Members β”‚ β”‚ - Member Functions β”‚ β”‚ - Access Specifiers β”‚ β”‚ (public, private, protected)β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> this Pointer β”œβ”€> Object Creation β”œβ”€> Member Initialization β”œβ”€> Static Members β”œβ”€> Friend Functions/Classes └─> Nested Classes ``` ### 6.2 Constructors & Destructors ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Constructors β”‚ β”‚ - Default Constructor β”‚ β”‚ - Parameterized Constructor β”‚ β”‚ - Copy Constructor β”‚ β”‚ - Constructor Overloading β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Move Constructor (C++11) β”œβ”€> Delegating Constructors (C++11) β”œβ”€> Initializer Lists β”œβ”€> explicit Keyword β”œβ”€> Converting Constructors └─> Constructor Member Initializer β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Destructors β”‚ β”‚ - Resource Cleanup β”‚ β”‚ - Virtual Destructors β”‚ β”‚ - Rule of Three/Five/Zero β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> RAII (Resource Acquisition Is Initialization) β”œβ”€> Default/Delete (C++11) └─> noexcept Destructors ``` ### 6.3 Operator Overloading ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Overloadable Operators β”‚ β”‚ - Arithmetic (+, -, *, /) β”‚ β”‚ - Comparison (==, !=, <, >) β”‚ β”‚ - Assignment (=) β”‚ β”‚ - Stream (<<, >>) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Member vs Non-member Overloading β”œβ”€> Subscript Operator [] β”œβ”€> Function Call Operator () β”œβ”€> Increment/Decrement (++, --) β”œβ”€> Conversion Operators └─> Spaceship Operator <=> (C++20) ``` ### 6.4 Inheritance ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Single Inheritance β”‚ β”‚ - Base & Derived Classes β”‚ β”‚ - Access Control β”‚ β”‚ - Constructor Chaining β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Multiple Inheritance β”œβ”€> Virtual Inheritance β”œβ”€> Diamond Problem β”œβ”€> protected Members β”œβ”€> Inheritance Types (public, protected, private) └─> Slicing Problem β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Polymorphism β”‚ β”‚ - Virtual Functions β”‚ β”‚ - Pure Virtual Functions β”‚ β”‚ - Abstract Classes β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Virtual Destructors β”œβ”€> Virtual Function Tables (vtable) β”œβ”€> Dynamic Binding β”œβ”€> override Keyword (C++11) β”œβ”€> final Keyword (C++11) └─> Runtime Type Information (RTTI) ``` --- ## Level 7: Templates (Requires Level 6) ### 7.1 Function Templates ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Template Syntax β”‚ β”‚ - template β”‚ β”‚ - Template Parameters β”‚ β”‚ - Template Instantiation β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Explicit Instantiation β”œβ”€> Template Specialization β”œβ”€> Function Template Overloading β”œβ”€> Template Argument Deduction └─> typename vs class Keyword ``` ### 7.2 Class Templates ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Template Classes β”‚ β”‚ - Member Functions β”‚ β”‚ - Static Members β”‚ β”‚ - Template Methods β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Class Template Specialization β”œβ”€> Partial Specialization β”œβ”€> Non-type Template Parameters β”œβ”€> Default Template Arguments β”œβ”€> Template Template Parameters └─> Friend Templates ``` ### 7.3 Advanced Templates ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Variadic Templates (C++11) β”‚ β”‚ - Parameter Packs β”‚ β”‚ - Pack Expansion β”‚ β”‚ - Fold Expressions (C++17) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> SFINAE (Substitution Failure Is Not An Error) β”œβ”€> std::enable_if β”œβ”€> Type Traits β”œβ”€> if constexpr (C++17) β”œβ”€> Concepts (C++20) └─> Requires Clauses (C++20) ``` --- ## Level 8: Modern C++ Features (Requires Level 1-7) ### 8.1 Smart Pointers (C++11) ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ std::unique_ptr β”‚ β”‚ - Exclusive Ownership β”‚ β”‚ - Move-only Semantics β”‚ β”‚ - Custom Deleters β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> std::shared_ptr β”œβ”€> std::weak_ptr β”œβ”€> make_unique (C++14) β”œβ”€> make_shared β”œβ”€> Circular Reference Problem └─> When to Use Which ``` ### 8.2 Move Semantics (C++11) ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ lvalue vs rvalue β”‚ β”‚ rvalue References (&&) β”‚ β”‚ std::move β”‚ β”‚ std::forward β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Move Constructor β”œβ”€> Move Assignment Operator β”œβ”€> Perfect Forwarding β”œβ”€> Reference Collapsing β”œβ”€> Universal References └─> Return Value Optimization (RVO, NRVO) ``` ### 8.3 Lambda Expressions (C++11) ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Lambda Syntax β”‚ β”‚ - [capture](params){} β”‚ β”‚ - Capture Clauses β”‚ β”‚ - Return Type Deduction β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Capture Modes ([=], [&], [this], [*this]) β”œβ”€> Generic Lambdas (C++14) β”œβ”€> Init Capture (C++14) β”œβ”€> constexpr Lambdas (C++17) β”œβ”€> Template Lambdas (C++20) └─> Lambda as Function Objects ``` ### 8.4 Standard Library Enhancements ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ C++11 Features β”‚ β”‚ - auto, decltype β”‚ β”‚ - nullptr β”‚ β”‚ - constexpr β”‚ β”‚ - Range-based for β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> C++14: Generic lambdas, digit separators β”œβ”€> C++17: Structured bindings, optional, variant, any β”œβ”€> C++20: Concepts, ranges, coroutines, modules └─> C++23: std::expected, multidimensional subscript ``` --- ## Level 9: STL - Standard Template Library (Requires Level 7-8) ### 9.1 Containers ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Sequence Containers β”‚ β”‚ - vector, deque, list β”‚ β”‚ - forward_list, array β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Associative Containers (set, map, multiset, multimap) β”œβ”€> Unordered Containers (unordered_set, unordered_map) β”œβ”€> Container Adaptors (stack, queue, priority_queue) β”œβ”€> span (C++20) └─> Container Selection Guidelines β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Container Operations β”‚ β”‚ - Insertion, Deletion β”‚ β”‚ - Access, Search β”‚ β”‚ - Iteration β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Iterator Invalidation β”œβ”€> Container Complexity (Big-O) └─> Container Performance Characteristics ``` ### 9.2 Iterators ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Iterator Categories β”‚ β”‚ - Input/Output Iterators β”‚ β”‚ - Forward/Bidirectional β”‚ β”‚ - Random Access Iterators β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Iterator Adaptors (reverse, insert, stream) β”œβ”€> Iterator Traits β”œβ”€> begin() / end() β”œβ”€> cbegin() / cend() β”œβ”€> rbegin() / rend() └─> Custom Iterators ``` ### 9.3 Algorithms ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Non-modifying Algorithms β”‚ β”‚ - find, count, search β”‚ β”‚ - min, max, accumulate β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Modifying Algorithms (copy, transform, replace) β”œβ”€> Sorting (sort, stable_sort, partial_sort) β”œβ”€> Binary Search (lower_bound, upper_bound) β”œβ”€> Heap Operations β”œβ”€> Numeric Algorithms └─> Ranges (C++20) ``` ### 9.4 Function Objects & Utilities ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Function Objects (Functors) β”‚ β”‚ - operator() Overloading β”‚ β”‚ - std::function β”‚ β”‚ - std::bind β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Standard Functors (plus, minus, less, greater) β”œβ”€> Predicate Functions β”œβ”€> Lambda as Functors └─> Function Pointers vs Functors ``` --- ## Level 10: Memory Management (Requires Level 5-8) ### 10.1 Manual Memory Management ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Stack vs Heap β”‚ β”‚ new & delete β”‚ β”‚ Memory Leaks β”‚ β”‚ Dangling Pointers β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Memory Alignment β”œβ”€> Placement new β”œβ”€> Custom Allocators β”œβ”€> Memory Pools └─> Object Pools ``` ### 10.2 Advanced Memory Concepts ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Memory Order & Layout β”‚ β”‚ - Structure Padding β”‚ β”‚ - alignof, alignas β”‚ β”‚ - Cache-friendly Structures β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Memory Profiling Tools β”œβ”€> Valgrind, AddressSanitizer β”œβ”€> Memory Leak Detection └─> Memory Optimization Techniques ``` --- ## Level 11: Concurrency (Requires Level 1-10) ### 11.1 Threading Basics ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ std::thread β”‚ β”‚ - Thread Creation β”‚ β”‚ - Thread Joining β”‚ β”‚ - Thread Detaching β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Thread Local Storage β”œβ”€> Thread IDs β”œβ”€> Hardware Concurrency └─> Thread Management ``` ### 11.2 Synchronization ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Mutexes β”‚ β”‚ - std::mutex β”‚ β”‚ - std::recursive_mutex β”‚ β”‚ - std::timed_mutex β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Lock Guards (std::lock_guard, std::unique_lock) β”œβ”€> Condition Variables β”œβ”€> std::atomic β”œβ”€> Memory Ordering β”œβ”€> std::future & std::promise └─> std::async β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Thread Safety β”‚ β”‚ - Data Races β”‚ β”‚ - Race Conditions β”‚ β”‚ - Deadlocks β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Lock-free Programming β”œβ”€> Wait-free Programming β”œβ”€> Compare-and-Swap (CAS) └─> Thread-safe Data Structures ``` --- ## Level 12: Exception Handling & Error Management (Requires Level 6) ### 12.1 Exceptions ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ try-catch Blocks β”‚ β”‚ throw Statement β”‚ β”‚ Standard Exceptions β”‚ β”‚ Custom Exceptions β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€> Exception Specifications (deprecated) β”œβ”€> noexcept (C++11) β”œβ”€> Exception Safety Guarantees β”œβ”€> RAII for Exception Safety └─> Stack Unwinding ``` ### 12.2 Error Handling Strategies ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Error Codes vs Exceptions β”‚ β”‚ std::optional (C++17) β”‚ β”‚ std::expected (C++23) β”‚ β”‚ std::variant (C++17) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ └─> Error Handling Best Practices ``` --- ## πŸ”— Dependency Map Summary ### Critical Learning Path ``` Level 1 (Basics) β†’ Level 2 (Control Flow) β†’ Level 3 (Functions) β†’ Level 4 (Arrays & Strings) β†’ Level 5 (Pointers & References) β†’ Level 6 (OOP) β†’ Level 7 (Templates) β†’ Level 8 (Modern C++) [can parallel with 9-11] β†’ Level 9 (STL) β†’ Level 10 (Memory) β†’ Level 11 (Concurrency) [can parallel with 10] β†’ Level 12 (Exceptions) ``` ### Parallel Learning Opportunities - Levels 8, 9, 10, 11 can be learned in parallel after mastering Level 7 - Exception handling (Level 12) can be introduced earlier but fully mastered later - Modern C++ features can be learned alongside traditional concepts --- ## πŸ“Š Prerequisite Matrix | Topic | Must Know First | Can Learn In Parallel | |-------|----------------|----------------------| | Pointers | Arrays, Functions | References | | References | Pointers basics | - | | Classes | Pointers, References | - | | Templates | Classes, Functions | - | | Smart Pointers | Pointers, RAII, Templates | Move Semantics | | Move Semantics | References, OOP | Smart Pointers | | STL | Templates, OOP | Modern C++ Features | | Concurrency | Pointers, References, OOP | Memory Management | | Lambdas | Functions, OOP | Templates | --- This knowledge graph ensures you build strong foundations before tackling advanced C++ concepts!