2022-04-14 06:43:12 +02:00
# Modern C++ Programming
2022-10-23 04:15:16 +02:00
< p align = "center" >
2021-11-28 16:06:01 +01:00
< img src = "other/cpp_logo.png" / >
2022-10-23 04:15:16 +02:00
< / p >
< p align = "center" >
< a href = "https://github.com/federico-busato/Modern-CPP-Programming/releases" alt = "Release" >
< img src = "https://img.shields.io/github/v/release/federico-busato/Modern-CPP-Programming?style=for-the-badge" / >
< / a >
< / p >
2023-12-03 01:54:13 +01:00
< p align = "center" >
< a alt = "Stars" >
< img src = "https://img.shields.io/github/stars/federico-busato/Modern-CPP-Programming?style=for-the-badge" / >
< / a >
< a href = "https://github.com/federico-busato/Modern-CPP-Programming/network/members" alt = "Forks" >
< img src = "https://img.shields.io/github/forks/federico-busato/Modern-CPP-Programming?style=for-the-badge" / >
< / a >
< / p >
2022-10-23 04:15:16 +02:00
< p align = "center" >
< a href = "https://github.com/federico-busato/Modern-CPP-Programming/commits/master" alt = "Commits" >
< img src = "https://badgen.net/github/commits/federico-busato/Modern-CPP-Programming?style=for-the-badge&scale=1.2" / >
< / a >
< / p >
< p align = "center" >
2023-12-03 01:54:13 +01:00
< a href = "https://github.com/federico-busato/Modern-CPP-Programming-Material/issues" alt = "Issues" >
< img src = "https://badgen.net/github/closed-issues/federico-busato/Modern-CPP-Programming?style=for-the-badge&scale=1.2" / >
2022-10-23 04:15:16 +02:00
< / a >
< / p >
2024-03-31 01:05:40 +01:00
## C++03 / C++11 / C++14 / C++17 / C++20 / C++23 / C++26
2018-03-08 12:04:09 +01:00
2021-11-01 13:59:47 +01:00
This *open-access* course is directed at those who are already familiar with C and object-oriented programming towards a proficiency level of C++ programming. The course covers the basics of C++ programming and moves on to advanced C++ semantics and concepts.
**Key features**:
- *Free and frequently updated*
2024-03-31 01:05:40 +01:00
- *25 lectures, 1600+ slides*
2021-11-01 13:59:47 +01:00
- Include the *last language standard* concepts and features
2023-12-03 01:54:13 +01:00
- *Practical teaching*: non-verbose, short structured descriptions associated with code
2021-11-01 13:59:47 +01:00
- *Minimal code examples* for showing just a specific feature or issue without digressing
- *Complementary language aspects*: tools, coding conventions, project organization, and code optimization
- *Experience-based*: many aspects, examples, and problems come from real-world cases faced during my work as software engineer
2024-03-31 01:05:40 +01:00
*If you enjoy the course or you find it useful*, please add a **Star**
2021-11-28 15:58:39 +01:00
2021-11-01 13:59:47 +01:00
[](https://github.com/federico-busato/Modern-CPP-Programming)
2022-04-14 06:43:12 +02:00
## CHAPTERS
2024-04-05 22:11:44 +02:00
| # | TITLE | MAIN FOCUS |
| ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| **1** | [**Introduction** ](01.Introduction.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/01.Introduction.html)) | History of C/C++, Areas of applications, Course introduction |
| **2** | [**Preparation** ](02.Preparation.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/02.Preparation.html)) | Books, How to compile, Hello world |
| **3** | [**Basic Concepts I** ](03.Basic_Concepts_I.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/03.Basic_Concepts_I.html)) | Type System, Fundamental types, and Operators |
| **4** | [**Basic Concepts II** ](04.Basic_Concepts_II.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/04.Basic_Concepts_II.html)) | Integral and Floating-point types and their arithmetic |
| **5** | [**Basic Concepts III** ](05.Basic_Concepts_III.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/05.Basic_Concepts_III.html)) | Entities, Enumerators, Structures, Control flow statements |
| **6** | [**Basic Concepts IV** ](06.Basic_Concepts_IV.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/06.Basic_Concepts_IV.html)) | Heap, Stack, Pointers, References, Const properties, Conversion operators |
| **7** | [**Basic Concepts V** ](07.Basic_Concepts_V.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/07.Basic_Concepts_V.html)) | Functions, Lambda expressions, Preprocessing directives |
| **8** | [**Object-Oriented Programming I** ](08.Object_Oriented_I.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/08.Object_Oriented_I.html)) | Class hierarchy, Constructor, Destructor, Class keywords |
| **9** | [**Object Oriented Programming II** ](09.Object_Oriented_II.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/09.Object_Oriented_II.html)) | Polymorphism, Operators overloading |
| **10** | [**Templates and Meta-programming I** ](10.Templates_I.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/10.Templates_I.html)) | Function template, Type traits, Compile-time utilities |
| **11** | [**Templates and Meta-programming II** ](11.Templates_II.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/11.Templates_II.html)) | Class template, SFINAE |
| **12** | [**Translation Units I** ](12.Translation_Units_I.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/12.Translation_Units_I.html)) | Linkage and One Definition Rule |
| **13** | [**Translation Units II** ](13.Translation_Units_II.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/13.Translation_Units_II.html)) | Dealing with multiple translation units and files,`#include`, Modules |
| **14** | [**Code Conventions** ](14.Code_Convention.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/14.Code_Convention.html)) | Project organization, Main code conventions |
| **15** | [**Debugging and Testing** ](15.Debugging.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/15.Debugging.html)) | Execution/memory debugging, Sanitizers, Harding techniques, Unit test, Test-Driven Development |
| **16** | [**Ecosystem** ](16.Ecosystem.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/16.Ecosystem.html)) | Cmake, Documenting, and Other Tools |
| **17** | [**Utilities** ](17.Utilities.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/17.Utilities.html)) | Main `std` libraries |
| **18** | [**Containers, Iterators, and Algorithms** ](18.Iterators_Containers_Alg.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/18.Iterators_Containers_Alg.html)) | Containers, Iterators, Algorithms, Ranges |
| **19** | [**Advanced Topics I** ](19.Advanced_Topics_I.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/19.Advanced_Topics_I.html)) | Move semantics, Universal reference, Type deduction |
| **20** | [**Advanced Topics II** ](20.Advanced_Topics_II.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/20.Advanced_Topics_II.html)) | Error handling, C++ idioms, Smart pointers |
| **21** | [**Performance Optimizations I** ](21.Optimization_I.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/21.Optimization_I.html)) | Ahmdal Law, Performance bounds, Architecture concepts (ILP, SIMD, etc.), Memory hierarchy |
| **22** | [**Performance Optimizations II** ](22.Optimization_II.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/22.Optimization_II.html)) | Arithmetic optimizations, Memory optimizations, etc. |
| **23** | [**Performance Optimizations III** ](23.Optimization_III.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/23.Optimization_III.html)) | Compiler optimizations, Profiling, Benchmarking tools |
2024-07-30 01:34:51 +02:00
| **24** | [**Software Design I** ](24.Software_Design_I.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/24.Software_Design_I.html)) | Basic Concepts, Principles, Use cases |
| **25** | [**Software Design II** ](25.Software_Design_II.pdf ) ([html](https://federico-busato.github.io/Modern-CPP-Programming/htmls/25.Software_Design_II.html)) | Design Patterns and Idioms |
2024-04-05 22:11:44 +02:00
***ALL-IN-ONE BOOK***: [**modern-cpp.pdf** ](modern-cpp.pdf ) (could be a few commits behind), [html ](https://federico-busato.github.io/Modern-CPP-Programming/htmls/modern-cpp.html )
2023-12-03 01:54:13 +01:00
2023-04-03 03:58:07 +02:00
## TOPICS IN DETAILS
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
**[1. Introduction](01.Introduction.pdf)**
2018-03-08 12:04:09 +01:00
2021-03-04 22:54:21 +01:00
* **A Little History of C/C++ Programming Languages**
* **Areas of Application and Popularity**
* **C++ Philosophy**
2024-03-31 01:05:40 +01:00
* **C++ Weakness**: C++ alternatives, Why switching to a new language is hard?
2021-03-04 22:54:21 +01:00
* **The Course**
2024-03-31 01:05:40 +01:00
**[2. Preparation](02.Preparation.pdf)**
2021-03-04 22:54:21 +01:00
2024-03-31 01:05:40 +01:00
- **Books and References**
- **Slide Legend**
- **What Editor/ IDE/Compiler Should I Use?**
- **How to compile?**
- **Hello World**: I/O Stream
**[3. Basic Concepts I - Type System, Fundamental Types, and Operators](03.Basic_Concepts_I.pdf)**
* **The C++ Type System**: Type categories, Type properties
* **C++ Fundamental Types Overview**: Arithmetic types, Suffix and prefix, Non-standard arithmetic types, `void` type, `nullptr`
2021-03-04 22:54:21 +01:00
* **Conversion Rules**
2022-04-14 06:43:12 +02:00
* **`auto` declaration**
2024-03-31 01:05:40 +01:00
* **C++ Operators**: Operators precedence, Prefix/Postfix increment/decrement, Assignment, compound, and comma operators, Spaceship operator `<=>` , Safe comparison operators
2023-11-20 21:43:18 +01:00
2024-03-31 01:05:40 +01:00
**[4. Basic Concepts II - Integral and Floating-point Types](04.Basic_Concepts_II.pdf)**
2023-11-20 21:43:18 +01:00
2024-03-31 01:05:40 +01:00
* **Integral Data Types**: Fixed width integers, `size_t` and `ptrdiff_t` , Signed/Unsigned integer characteristics, Promotion, Truncation, Undefined behavior
* **Floating-point Types and Arithmetic**: IEEE Floating-point standard and other representations, Normal/Denormal values, Infinity, Not a Number (`NaN`), Machine Epsilon, Units at the Last Place (ULP), Cheatsheet, Limits and useful functions, Arithmetic properties, Special values behavior, Undefined behavior, Detect floating-point errors
2022-04-14 06:43:12 +02:00
* **Floating-point Issues**: Catastrophic cancellation, Floating-point comparison
2021-03-04 22:54:21 +01:00
2024-03-31 01:05:40 +01:00
**[5. Basic Concepts III - Entities and Control Flow](05.Basic_Concepts_III.pdf)**
2021-03-04 22:54:21 +01:00
2023-12-21 22:34:43 +01:00
* **Entities**
* **Declaration and Definition**
2021-03-04 22:54:21 +01:00
* **Enumerators**
2023-03-19 00:00:53 +01:00
* **`struct`, Bitfield, `union` **
2024-03-31 01:05:40 +01:00
* **`[[deprecated]]` Attribute**
* **Control Flow**: `if` statement, `for` loop, Range-base `for` loop, `switch` , `goto` , Avoid unused variable warning
2021-03-04 22:54:21 +01:00
2024-03-31 01:05:40 +01:00
**[6. Basic Concepts IV - Memory Concepts](06.Basic_Concepts_IV.pdf)**
2021-03-04 22:54:21 +01:00
2024-03-31 01:05:40 +01:00
* **Heap and Stack**: Stack memory, `new` , `delete` , Non-allocating placement allocation, Non-throwing allocation, Memory leak
2023-09-15 01:30:21 +02:00
* **Initialization**: Variable initialization, Uniform initialization, Fixed-size array initialization, Structure initialization, Dynamic memory initialization
2024-03-31 01:05:40 +01:00
* **Pointers and References**: Pointer operations, Address-of operator `&` , Reference
2023-09-15 01:30:21 +02:00
* **Constant and Literals, `const` , `constexpr` , `consteval` , `constinit` **, `if constexpr` , `std::is constant evaluated()` , `if consteval`
2023-10-23 23:41:29 +02:00
* **`volatile` keyword**
2021-09-19 18:39:53 +02:00
* **Explicit Type Conversion**: `static_cast` , `const_cast` , `reinterpret_cast` , Type punning
2024-03-31 01:05:40 +01:00
* **`sizeof` Operator**: overview, `[[no_unique_address]]`
2019-03-04 11:29:53 +01:00
2024-03-31 01:05:40 +01:00
**[7. Basic Concepts V - Functions and Preprocessing](07.Basic_Concepts_V.pdf)**
2019-03-04 11:29:53 +01:00
2024-03-31 01:05:40 +01:00
* **Functions**: Pass by-value, Pass by-pointer, Pass by-reference, Function signature and overloading, Overloading and `=delete` , Default parameters, Attributes `[[attributes]]`
* **Function Pointer and Function Objects**
2023-12-21 22:34:43 +01:00
* **Lambda Expressions**: Capture list, Parameters, Composability, `constexpr/consteval` , `template` , `mutable` , `[[nodiscard]]` , Capture list and classes
2024-03-31 01:05:40 +01:00
* **Preprocessing**: Preprocessors, Common errors, Source location macros, Conditional compiling macros, Stringizing operator (`#`), `#error` and `warning` , `#pragma` , Token-pasting operator (`##`), Variadic macro
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
**[8. Object-Oriented Programming I - Class Concepts](08.Object_Oriented_I.pdf)**
2019-03-04 11:29:53 +01:00
2024-03-31 01:05:40 +01:00
* **C++ Classes**: RAII idiom
2023-12-21 22:34:43 +01:00
* **Class Hierarchy**
* **Access specifiers**: Inheritance access specifiers, When use `public/protected/private` for data members?
2024-01-29 00:01:35 +01:00
* **Class Constructor**: Default constructor, Class initialization, Uniform initialization for objects, Delegate constructor, `explicit` keyword, `[[nodiscard]]` and classes
2021-03-04 22:54:21 +01:00
* **Copy Constructor**
* **Class Destructor**
2023-09-15 01:30:21 +02:00
* **Defaulted Constructors, Destructor, and Operators** (`= default`)
2021-03-04 22:54:21 +01:00
* **Class Keywords**: `this` , `static` , `const` , `mutable` , `using` , `friend` , `delete`
2019-03-04 11:29:53 +01:00
2024-03-31 01:05:40 +01:00
**[9. Object-Oriented Programming II - Polymorphism and Operator Overloading](09.Object_Oriented_II.pdf)**
2018-03-08 12:04:09 +01:00
2021-09-19 18:39:53 +02:00
* **Polymorphism**: `virtual` methods, Virtual table, `override` keyword, `final` keyword, Common errors, Pure virtual method, Abstract class and interface
2021-03-19 19:51:45 +01:00
* **Inheritance Casting and Run-time Type Identification**
2024-03-31 01:05:40 +01:00
* **Operator Overloading**: Overview, Comparison operator `<` , Spaceship operator `<=>` , Subscript operator `[]` , Multidimensional subscript operator `[]` , Function call operator `()` , static operator `[]` and operator `()` , Conversion operator `T()` , Return type overloading resolution, Increment and decrement operators `++` /`--`, Assignment operator `=` , Stream operator `<<` , Operator notes
* **C++ Object Layout**: Aggregate, Trivial class, Standard-layout class, Plain old data (POD), Hierarchy
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
**[10. Templates and Meta-programming I - Function Templates and Compile-Time Utilities](10.Templates_I.pdf)**
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
* **Function Template**: Overview, Template parameters,Template instantiation, Template parameter - default value, Overloading, Specialization
2023-03-19 00:00:53 +01:00
* **Template Variable**
2024-03-31 01:05:40 +01:00
* **Template Parameter Types**: Generic Type Notes, `auto` Placeholder, Class template parameter type, Array and pointer types, Function type
* **Compile-Time Utilities**: `static_assert` , `decltype` keyword, `using` keyword
2023-03-19 00:00:53 +01:00
* **Type Traits**: Overview, Type traits library, Type manipulation
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
**[11. Templates and Meta-programming II - Class Templates and SFINAE](11.Templates_II.pdf)**
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
* **Class Template**: Class specialization, Class template constructor
* **Constructor template automatic deduction (CTAD)**
* **Class Template - Advanced Concepts**: Class + Function - specialization, Dependent names - `typename` and `template` keywords, Class template hierarchy and `using` , `friend` keyword, Template template arguments
2021-03-04 22:54:21 +01:00
* **Template Meta-Programming**
2024-03-31 01:05:40 +01:00
* **SFINAE: Substitution Failure Is Not An Error**: Function SFINAE, Class SFINAE
* **Variadic Template**: Folding expression, Variadic class template
* **C++20 Concepts**: Overview, `concept` keyword, `requires` clause, `requires` expression, `requires` expression + clause, `requires` clause + expression, `requires` and `constexpr` , Nested `requires`
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
**[12. Translation Units I - Linkage and One Definition Rule](12.Translation_Units_I.pdf)**
2018-03-08 12:04:09 +01:00
2021-09-19 18:39:53 +02:00
* **Basic Concepts**: Translation unit, Local and global scope, Linkage
2023-03-19 00:00:53 +01:00
* **Storage Class and Duration**: Storage duration, Storage class, `static` and `extern` keywords, Internal/External linkage examples
2024-03-31 01:05:40 +01:00
* **Linkage of `const` and `constexpr` **: Static initialization order fiasco
2023-03-19 00:00:53 +01:00
* **Linkage Summary**
2022-04-23 21:27:55 +02:00
* **Dealing with Multiple Translation Units**: Class in multiple translation units
2023-03-19 00:00:53 +01:00
* **One Definition Rule (ODR)**: Global variable issues, ODR - Point 3, `inline` functions/variables, `constexpr` and `inline`
* **ODR - Function Template**: Cases, `extern` keyword
* **ODR - Class Template**: Cases, `extern` keyword
* **ODR Undefined Behavior and Summary**
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
**[13. Translation Units II - Include, Module, and Namespace](13.Translation_Units_II.pdf)**
2023-04-03 03:58:07 +02:00
2024-03-31 01:05:40 +01:00
- **`#include` Issues**: Include guard, Forward declaration, Circular dependencies, Common linking errors
- **C++20 Modules**: Overview, Terminology, Visibility and reachability, Module unit types, Keywords, Global module fragment, Private module fragment, Header module unit, Module partitions
2023-04-03 03:58:07 +02:00
- **Namespace**: Namespace functions vs. `static` methods, Namespace alias, Anonymous namespace, `inline` namespace, Attributes and namespace
- **Compiling Multiple Translation Units**: Fundamental compiler flags, Compile Methods, Deal with libraries, Build static/dynamic libraries, Find dynamic library dependencies, Analyze object/executable symbols
2024-03-31 01:05:40 +01:00
**[14. Code Conventions](14.Code_Convention.pdf)**
2019-03-04 11:29:53 +01:00
2024-03-31 01:05:40 +01:00
* **C++ Project Organization**: Project directories, Project files, "Common" project organization notes, Alternative - “Canonical” project organization
2021-03-04 22:54:21 +01:00
* **Coding Styles and Conventions**
2021-03-19 19:51:45 +01:00
* **`#include`**
2021-03-04 22:54:21 +01:00
* **Macro and Preprocessing**
* **Namespace**
2023-12-21 22:34:43 +01:00
* **Variables and Arithmetic Types**
2021-03-04 22:54:21 +01:00
* **Functions**
* **Structs and Classes**
2021-09-19 18:39:53 +02:00
* **Control Flow**
2021-03-04 22:54:21 +01:00
* **Modern C++ Features**
* **Maintainability**
2023-09-15 01:30:21 +02:00
* **Naming**
2023-11-20 21:43:18 +01:00
* **Readability and Formatting**
2021-03-04 22:54:21 +01:00
* **Code Documentation**
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
**[15. Debugging and Testing](15.Debugging.pdf)**
2019-03-04 11:29:53 +01:00
2023-03-19 00:00:53 +01:00
* **Debugging**
* **Assertion**
2024-03-31 01:05:40 +01:00
* **Execution debugging**: Breakpoints, Watchpoints / Catchpoints, Control flow, Stack and Info, Print, Disassemble
* **Memory Debugging**: `valgrind`
* **Hardening Techniques**: Stack usage, Standard library checks, Undefined behavior protections, Control flow protections
2021-09-19 18:39:53 +02:00
* **Sanitizers**: Address sanitizer, Leak sanitizer, Memory sanitizers, Undefined behavior sanitizer
2021-03-04 22:54:21 +01:00
* **Debugging Summary**
2023-09-15 01:30:21 +02:00
* **Compiler Warnings**
* **Static Analysis**
2023-12-21 22:34:43 +01:00
* **Code Testing**: Unit test, Test-Driven Development (TDD), Code coverage, Fuzz testing
2021-03-04 22:54:21 +01:00
* **Code Quality**: `clang-tidy`
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
**[16. Ecosystem - Cmake and Other Tools](16.Ecosystem.pdf)**
2023-04-03 03:58:07 +02:00
- **CMake**: `cmake` and `ctest`
- **Code Documentation**: `doxygen`
- **Code Statistics**: Count lines of code, Cyclomatic complexity analyzer
2024-03-31 01:05:40 +01:00
- **Other Tools**: Code formatting - `clang-format` , `Compiler Explorer` , Code transformation - `CppInsights` , Code autocompletion - `GitHub Co-Pilot/TabNine/Kite` , Local code search - `ugrep` , `ripgrep` , `hypergrep` , Code search engine - `searchcode/grep.app` , Code benchmarking - `Quick-Bench` , Font for coding
2023-04-03 03:58:07 +02:00
2024-03-31 01:05:40 +01:00
**[17. Utilities](17.Utilities.pdf)**
2020-04-06 12:47:46 +02:00
2021-03-04 22:54:21 +01:00
* **I/O Stream**: Manipulator, `ofstream/ifstream`
2023-11-20 21:43:18 +01:00
* **Strings**: `std::string` , Conversion from/to numeric values, `std::string_view` , `std::format` , `std::print`
2024-03-31 01:05:40 +01:00
* **View**: `std::span`
2023-12-21 22:34:43 +01:00
* **Math Libraries**
2024-03-31 01:05:40 +01:00
* **Random Number**: Basic concepts, C++ `<random>` , Seed, PRNG period and quality, Distribution, Quasi-random
2021-09-19 18:39:53 +02:00
* **Time Measuring**: Wall-Clock time, User time, System time
2024-01-17 01:58:44 +01:00
* **Std Class Templates**: `std::pair` , `std::tuple` , `std::variant` , `std::optional` , `std::any` , `std::stacktrace`
2021-09-19 18:39:53 +02:00
* **Filesystem Library**: Query methods, Modify methods
2020-04-06 12:47:46 +02:00
2024-03-31 01:05:40 +01:00
**[18. Containers, Iterators, and Algorithms](18.Iterators_Containers_Alg.pdf)**
2020-04-06 12:47:46 +02:00
2021-03-04 22:54:21 +01:00
* **Containers and Iterators**
* **Sequence Containers**: `std::array` , `std::vector` , `std::list` , `std::deque` , `std::forward_list`
2021-09-19 18:39:53 +02:00
* **Associative Containers**: `std::set` , `std::map` , `std::multiset`
2021-03-04 22:54:21 +01:00
* **Container Adaptors**: `std::stack` , `std::queue` , `std::priority_queue`
2021-09-19 18:39:53 +02:00
* **View**: `std::span`
2021-11-01 13:59:47 +01:00
* **Implement a Custom Iterator**: Semantic, Implement a simple Iterator
2024-03-31 01:05:40 +01:00
* **Iterator Notes**:
2022-10-23 04:15:16 +02:00
* **Iterator Utility Methods**: `std::advance` , `std::next` , `std::prev` , `std::distance` , Container access methods, Iterator traits
2021-03-04 22:54:21 +01:00
* **Algorithms Library**: `std::find_if` , `std::sort` , `std::accumulate` , `std::generate` , `std::remove_if`
2022-10-23 04:15:16 +02:00
* **C++20 Ranges**: Key concepts, Range view, Range adaptor, Range factory, Range algorithms, Range actions
2020-04-06 12:47:46 +02:00
2024-03-31 01:05:40 +01:00
**[19. Advanced Topics I](19.Advanced_Topics_I.pdf)**
2018-03-08 12:04:09 +01:00
2024-03-31 01:05:40 +01:00
* **Move Semantic**: `lvalues` and `rvalues` references, Move semantic, `std::move` , Class declaration semantic
2021-09-19 18:39:53 +02:00
* **Universal Reference and Perfect Forwarding**: Universal reference, Reference collapsing rules, Perfect forwarding
2021-03-04 22:54:21 +01:00
* **Value Categories**
2023-10-23 23:41:29 +02:00
* **`& `, `&&` Ref-qualifiers and `volatile` Overloading**
2021-03-04 22:54:21 +01:00
* **Copy Elision and RVO**
2024-04-05 22:11:44 +02:00
* **Type Deduction**: Pass by-reference, Pass by-pointer, Pass by-value, `auto` deduction, `auto(x)` : Decay-copy
2021-03-04 22:54:21 +01:00
* **`const` Correctness**
2019-03-04 11:29:53 +01:00
2024-03-31 01:05:40 +01:00
**[20. Advanced Topics II](20.Advanced_Topics_II.pdf)**
2023-04-03 03:58:07 +02:00
2024-03-31 01:05:40 +01:00
- **Undefined Behavior:** Illegal behavior, Platform specific behavior, unspecified behavior, Detecting undefined behavior
- **Error Handling**: Recoverable error handing, Return code, C++ Exceptions, Defining custom exceptions, `noexcept` keyword, Memory allocation issues, Return code and exception summary, `std::expected` , Alternative error handling approaches
2023-04-03 03:58:07 +02:00
- **Smart pointers**: `std::unique_ptr` , `std::shared_ptr` , `std::weak_ptr`
2024-03-31 01:05:40 +01:00
- **Concurrency**: Thread methods, Mutex, Atomic, Task-based parallelism
2023-04-03 03:58:07 +02:00
2024-03-31 01:05:40 +01:00
**[21. Optimization I - Basic Concepts](21.Optimization_I.pdf)**
2022-06-24 08:01:49 +02:00
2024-03-31 01:05:40 +01:00
* **Introduction**: Moore's Law, Moore's Law limitations, Reasons for optimizing
* **Basic Concepts**: Asymptotic complexity, Time-Memory trade-off, Developing cycle, Ahmdal's law, Throughput, Bandwidth, Latency, Performance bounds, Arithmetic intensity
* **Basic Architecture Concepts**: Instruction throughput, In-Order, and Out-of-Order Execution, Instruction pipelining, Instruction-level parallelism (ILP), Little’ s law, Data-level parallelism (DLP) and SIMD, Thread-level parallelism (TLP), Single Instruction Multiple Threads (SIMT), RISC, CISC instruction sets
* **Memory Hierarchy**: Memory hierarchy concepts, Memory locality, Core-to-core latency and thread affinity, Memory ordering model
2022-06-24 08:01:49 +02:00
2024-03-31 01:05:40 +01:00
**[22. Optimization II - Code Optimization](22.Optimization_II.pdf)**
2019-03-04 11:29:53 +01:00
2023-03-19 00:00:53 +01:00
* **I/O Operations**: `printf` , Memory mapped I/O, Speed up raw data loading
2024-03-31 01:05:40 +01:00
* **Memory Optimizations**: Heap memory, Stack memory, Cache utilization, Data alignment, Memory Prefetch
* **Arithmetic Types**: Data types, Arithmetic operations, Conversion, Floating-point, Compiler intrinsic functions, Value in a range, Lookup table
* **Control Flow**: Branch Hints - `[[likely]]` / `[[unlikely]]` , Signed/Unsigned integers, Loops, Loop hoisting, Loop unrolling, Assertions, Compiler hints `[[assume]]` , Recursion
* **Functions**: Function call cost, Argument passing, Function inlining, Function attributes, Pointers aliasing
2023-12-21 22:34:43 +01:00
* **Object-Oriented Programming**
2023-09-15 01:30:21 +02:00
* **Std Library and Other Language Aspects**
2020-03-01 12:50:30 +01:00
2024-03-31 01:05:40 +01:00
**[23. Optimization III - Non-Coding Optimizations and Benchmarking](23.Optimization_III.pdf)**
2020-03-01 12:50:30 +01:00
2024-03-31 01:05:40 +01:00
* **Compiler Optimizations**: About the compiler, Compiler optimization flags, Floating-point optimization flags, Linker optimization flags, Architecture flags, Help the compiler to produce better code, Profile guided optimization (PGO), Post-processing binary optimizer
* **Compiler Transformation Techniques**: Basic transformations, Loop unswitching, Loop fusion, Loop fission, Loop interchange, Loop tiling
2023-12-21 22:34:43 +01:00
* **Libraries and Data Structures**: External libraries
2024-03-31 01:05:40 +01:00
* **Performance Benchmarking**: What to test?, Workload/Dataset quality, Cache behavior, Stable CPU performance, Multi-threads considerations, Program memory layout, Measurement overhead, Compiler optimizations, Metric evaluation
2021-03-04 22:54:21 +01:00
* **Profiling**: `gprof` , `uftrace` , `callgrind` , `cachegrind` , `perf` Linux profiler
2024-04-05 22:11:44 +02:00
* **Parallel Computing**: Concurrency vs. parallelism, Performance scaling, Gustafson's Law, Parallel programming languages
2021-03-04 22:54:21 +01:00
2024-03-31 01:05:40 +01:00
**[24. Software Design I - Basic Concepts (DRAFT)](24.Software_Design_I.pdf)**
2021-11-01 13:59:47 +01:00
2024-03-31 01:05:40 +01:00
- **Books and References**
- **Basic Concepts**: Abstraction, interface, and module, Class Invariant
- **Software Design Principles**: Separation of concern, Low coupling, high cohesion, Encapsulation and information hiding, Design by contract, Problem decomposition, Code reuse
- **Software Complexity**: Software entropy, Technical debt
- **The SOLID Design Principles**
- **Member Functions vs. Free Functions**
- **BLAS GEMM Case Study**
- **Owning Objects and Views**
- **Value vs. Reference Semantic**
- **Global Variables**
**[25. Software Design II - Design Patterns and Idioms (DRAFT)](25.Software_Design_II.pdf)**
- **C++ Idioms**: Rule of Zero, Rule of Three, Rule of Five
- **Design Pattern**: Singleton, PIMPL, Curiously Recurring Template Pattern (CRTP), Template virtual functions
### Roadmap
1. Improve Software Design Chapters
2. Build Aspects Chapter (e.g. reducing build time)
2018-03-08 12:04:09 +01:00
2023-12-03 01:54:13 +01:00
### Reporting bugs 🐛 and contributing
If you find any typo, conceptual error, or section to improve, please report them by using the `issue` panel.
2018-03-08 12:04:09 +01:00
2022-04-14 06:43:12 +02:00
## Author
2018-03-08 12:04:09 +01:00
2024-02-08 07:28:28 +01:00
`Federico Busato` , https://federico-busato.github.io/
2021-05-20 13:12:28 +02:00
2023-11-20 21:43:18 +01:00
- LinkedIn: [www.linkedin.com/in/federico-busato/ ](https://www.linkedin.com/in/federico-busato/ )
2024-03-31 01:05:40 +01:00
- Twitter: [twitter.com/fedebusato ](https://twitter.com/fedebusato )