My self-study guide on learning CPP
All of the notes are color-coded. Each color stands for a different meaning.
- Blue: Definitions
- Orange: Title of A New Concept
- Yellow: Operations/Important Ideas
- Red: Warning
- Purple: Things to be Noted
- Pink: Title of a Minor Concept
- Primitive Built-in Types
1. Primitive Built-in Types - Variables
1.Variables - Compound Types
1. Identifiers&Reference 2. Pointers - Const Quantifier
1. Const Quantifier 2. Const Continue 3. Const Cotinue(2) - Deal with Types
1. Type Alias&Keyword auto 2. Keyword Decltype - Define Our Own Data Structure
1. Struct Data Type&Preprocessor
- Namespace using Declarators
1. Namespace using Declarators - Library String Type
1. Defining and Initialzing Strings 2. String Operations 3. For Each Loop 4. Subscript and Iteration - Library Vector Type
1. Intro to Vector 2. Vector Operations - Iterators
1. Intro to Iterators 2. Using Iterators 3. Iterator Arithmetic - Arrays
1. Define an Array&Access Elements in an Array 2. C-Style String 3. Multidimensional Arrays
- Fundamentals
1. Associativity&Precedence - Arithmetic Operators
1. Arithmetic Operators - Logical and Relational Operator
- Assignment Operator
- Increment and Decrement Operator
- The Member Access Operator
- The Conditional Operator
- Sizeof Operator
- Type Conversion
1. The arithmetic Conversion 2. Explicit Type Conversion
- Function Basics
- Argument Passing
1. Pass Arguments by Value&Reference 2. Const Parameter 3. Pass Array to A Function 4. Functions with Varying Parameters - Return Types and Return Statements
- Overloaded Functions
- Features for Specialized Uses
1. Default Arguments 2. Inline and Constexpr Functions - Function Matching
- Function Pointer
- Defining Abstract Data Types
1. Define struct Class&Keyword this 2. Define Member Function 3. Define Nonmember Function 4. Constructors - Encapsulation
- Additional Class Features
1. Define In-Class Type, Inline Functions, Overloading Functions, and Mutable Members 2. Return *this 3. Class Type and Friendship Revisit - Class Scope
- Constructor Revisited
1. Constructor Initializer 2. Delegating Constructor and Default Constructor 3. Implicit Class-Type Conversion - Static Class Member
- The IO Class
1. Condition States 2. Manage the Output Buffer - File Input and Output
1. Using ifstream and ofstream by inheritance 2. File Mode - String Streams
- Overview of The Sequential Containers
- Container Library Overview
1. Iterators 2. Container Type, begin() and end(), and Container Initialization 3. assign and swap 4. Container Size Operation and Container Comparison - Sequential Container Operations
1. Element Insertion 2. Access and Erase Elements 3. Specialized forward_list Operations 4. Potential Invalid Iterator after Insertion or Addition - Vector/String Members: reserve, shrink_to_fit, capacity
- Additional String Operations
1. Overloaded insert and erase&append and replace 2. String find, compare, and to numeric value - Adaptors
- Overview: How the algorithms work?
- A First Look At the Algorithms
1. Read-only Algorithms 2. Algorithms that Write Containers 3. Algorithms that Reorder the Container - Customizing Operations
1. Passing Predicates and Lambda Expression 2. Capture Variable by Reference/Value, Implicit Capture, and Mutable Lambda 3. Binding Arguments - Revisiting Iterator
1. Insert Iterator&IO iterator 2. Reverse Iterator 3. Iterator Categories 4. Algorithm Parameter and Naming Patterns&Special Members for List
- Using map and set
- Overview of Associative Container
1. Initialization&Requirements on Element Type 2. The Pair Type - Associative Container Operations
1. Iterator&Adding Elements 2. Erasing&Accessing Elements 3. lower_bound, uppoer_bound&equal_range 4. Practice: Word Transformation Program - Unordered Associative Container
- Dynamic Memory and Smart Pointers
1. Allocate Dynamic Memory and Intro to Smart Pointers 2. Automatic Memory Free&Dynamic Class 3. Manage Memory Directly using new and delete 4. Smart Pointers&Built-in Pointers 5. Smart Pointer and Exceptions 6. unique_ptr 7. weak_ptr - Dynamic Array
1. new Arrays 2. Destroy Dynamic Arrays&Intro to allocator
- Copy, Assign, and Destroy
1. Copy Constructor 2. Copy Assignment Operator and Destructor 3. Define copy with destructors, indicate synthesized with =default, and =delete 4. Private Copy Control - Copy Control and Resource Management: Valuelike and Pointerlike Class
- Swap
- Example: Folder and Message
- Class That Manage Resources: StrVec
- Moving Objects
1. Rvalue Reference 2. Move Constructor and Move-Assignment Operator
- Intro to Overloaded Operators
- Overload the Input and Output Operators
- Overloaded Arithmetic, Relational, and Assignment Operator
- Overloaded Subscript, Decrement, and Increment Operator
- Function Call Operators
1. Overloaded Member Access and Function Call Operator 2. Lambdas are Function Objects 3. Library Defined Function Objects
- Intro to Inheritance
- Define Base and Derived Classes
1. Define Base Class and Derived-to-Base Conversion 2. Derived Class Constructor, Member Using, Static Member, Inheritance Preventing, and Declaration 3. Conversion between Base and Derived Class - Override Virtual Functions
- Abstract Base Class
- Access Control and Inheritance
1. Access to Members and Derived-to-Base Conversion 2. Friendship in Inheritance, Exempt Individual Members, and Default Protection - Class Scope under Inheritence
- Constructors and Copy Control
1. Virtual Constructor and Synthesized copy, control 2. Derived Class Copy Constructor 3. Inherited Constructor
- Defining a Template
1. Function Templates 2. Class Template 3. Definition of Blob 4. Template Friendship - Overloading and Templates
- Variadic Template
- Specialized Template
- The tuple Type
1. Defining and Initializing tuples
- Basics of struct and Operations of struct
- Array of Structures
- Self-Referential Struct: Binary Tree
- Typedef and Struct
- Bit-fields
- getchar and putchar
- printf
- Variable-length Argument List and scanf
- File Access
- Error Handling
- Line Input and Output
- Miscellaneous Functions
- Item 2: Prefer const, enums, and inlines to #define
- Item 3: Use const Whenever Possible
- Item 4: Make sure objects are initialized before they are used
- Item 5: Know what functions C++ silently writes and calls
- Item 6: Explicitly disallow the use of copmiler-generated functions we do not want
- Item 7: Declare destructors virtual in polymorphic base classes
- Item 9: Don't call virtual functions in constructors or destructors
- Item 10: Have assignment operators return a reference to *this
- Item 11: Handle assignment to self in operator=
- Item 12: Copy all parts of an object