/Modern-CPP-Programming

Modern C++ Programming Course

BSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Modern C++ Programming

C++11/C++14/C++17

Essential Tool

Online compiler and execution: CompilerExplorer

  • for code execution: [Add new..] -> [execution only]

TOPICS

1. Introduction

  • A Little History of C/C++ Programming Languages
  • Areas of Application and Popularity
  • C++ Philosophy
  • Books and References
  • The Course

2. Basic Concepts I

  • Prerequirements: Compiler, editor, etc.
  • Hello World
  • C++ Primitive Types
  • Integral Data Types
  • Floating-point Arithmetic
  • Floating-point Issues

3. Basic Concepts II

  • Enumerators
  • union and Bitfield
  • using, decltype, and auto
  • Math Operators
  • Statements and Control Flow

4. Basic Concepts III

  • Memory Management: Heap and Stack
  • Initialization
  • Pointers and References
  • sizeof Operator
  • const and constexpr
  • Explicit Type Conversion

5. Basic Concepts IV

  • Declaration and Definition
  • Functions
  • Preprocessing

6. C++ Object Oriented Programming I

  • C++ Classes
  • Class Constructor
  • Copy Construcor
  • Class Destructor
  • Initialization and Defaulted Members
  • Class Keywords

7. C++ Object Oriented Programming II

  • Polymorphism
  • Operator overloading
  • Special Objects

8. C++ Templates and Meta-programming I

  • Function Templates
  • Compile-Time Utilities
  • Type Traits
  • Template Parameters

9. C++ Templates and Meta-programming II

  • Class Templates
  • Template Meta-Programming
  • SFINAE: Substitution Failure Is Not An Error
  • Variadic Template

10. Translation Units

  • Basic Concepts
  • Linkage
  • Variables Storage
  • Function Template
  • Class Template
  • Undefined Behavior and Summary
  • #include Issues
  • Namespace
  • How to Compile: static and dynamic libraries

11. Code Conventions

  • C++ Project Organization
  • Coding Styles and Conventions
  • #include and namespace
  • Variables and Prepossessing
  • Functions and Classes
  • Modern C++ Features
  • Control Flow
  • Naming and Formatting

12. Ecosystem

  • Execution Debugging: gdb and assert
  • Memory Debugging: valgrind
  • Sanitizers: address, leak, memory, undefined behavior
  • Debugging Summary
  • CMake
  • Code Checking and Analysis: warnings and static analyzers
  • Code Quality: linters
  • Code Testing: unit test, coverage
  • Code Commenting: doxygen
  • Code Statistics: lines count, cyclomatic complexity
  • Other Tools: code formatting, exploring, benchmarking

13. Utilities

  • I/O Stream
  • STD Template Utility
  • Filesystem Library
  • Math Functions
  • Algorithm Library
  • std::string and std::string_view
  • Random Numbers
  • Time Measuring

14. Containers, Iterators, and Algorithms

  • Containers and Iterators
  • Sequence Containers: array, vector, list, deque, forward_list
  • Associative Containers: set, map
  • Container Adaptors: stack, queue, priority_queue
  • Implement a Custom Iterator
  • Iterator Utility Methods
  • Algorithms Library
  • Lambda Expressions

15. Advanced Topics

  • Move Semantic
  • Copy Elision and RVO
  • Type deduction
  • C++ Idioms: rule of zero/three/five, singleton, PILP, CRTP
  • Smart Pointers
  • Concurrency: std::thread

16. Optimization I

  • General Concepts: asymptotic complexity, optimization cycle, Ahmdal Law, etc.
  • I/O Operations
  • Locality and Memory Access Patterns
  • Arithmetic
  • Control Flow
  • Functions
  • C++ Objects

17. Optimization II

  • Compiler Optimizations
  • Libraries and Data Structures
  • Profiling
  • Parallel Computing

Reporting bugs and contributing

If you find any typos, conceptual errors, or sections to improve, please report them by writing directly to me or by using the issue panel

Author

License

BSD 3-Clause License

Copyright (c) 2020, Modern C++ Programming All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.