2019-03-04 11:34:32 +01:00
|
|
|
# Modern C++ Programming #
|
|
|
|
## C++11/C++14/C++17 ##
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2019-03-04 11:34:32 +01:00
|
|
|
Open access C++ course, University of Verona (UNIVR), Italy
|
2018-03-09 19:39:45 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
### Essential Tool ###
|
|
|
|
|
|
|
|
Online compiler and execution: [CompilerExplorer](https://godbolt.org/)
|
|
|
|
|
|
|
|
* for code execution: [Add new..] -> [execution only]
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
## TOPICS ##
|
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**1. Introduction**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2019-03-04 11:29:53 +01:00
|
|
|
* A Little History of C/C++ Programming Languages
|
2018-03-08 12:04:09 +01:00
|
|
|
* C++ Philosophy
|
2019-03-04 11:29:53 +01:00
|
|
|
* Why C++?
|
2020-03-01 12:50:30 +01:00
|
|
|
* Course Overview and References
|
|
|
|
* Who I Am
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**2. Basic Concepts I**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
* Prerequirements: Compiler, editor, etc.
|
2018-03-08 12:04:09 +01:00
|
|
|
* Hello World
|
|
|
|
* C++ Primitive Types
|
2020-03-01 12:50:30 +01:00
|
|
|
* Integral Data Types
|
2019-03-04 11:29:53 +01:00
|
|
|
* Floating-point Arithmetic
|
2020-03-01 12:50:30 +01:00
|
|
|
* Floating-point Issues
|
|
|
|
|
|
|
|
**3. Basic Concepts II**
|
|
|
|
|
|
|
|
* Enumerators
|
|
|
|
* `union` and Bitfield
|
|
|
|
* `using`, `decltype`, and `auto`
|
2018-03-08 12:04:09 +01:00
|
|
|
* Math Operators
|
2020-03-01 12:50:30 +01:00
|
|
|
* Statements and Control Flow
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**4. Basic Concepts III**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
* Memory Management: Heap and Stack
|
2020-03-01 12:50:30 +01:00
|
|
|
* Initialization
|
2018-03-08 12:04:09 +01:00
|
|
|
* Pointers and References
|
2020-03-01 12:50:30 +01:00
|
|
|
* `sizeof` Operator
|
|
|
|
* `const` and `constexpr`
|
|
|
|
* Explicit Type Conversion
|
2019-03-04 11:29:53 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**5. Basic Concepts IV**
|
2019-03-04 11:29:53 +01:00
|
|
|
|
2018-03-08 12:04:09 +01:00
|
|
|
* Declaration and Definition
|
|
|
|
* Functions
|
|
|
|
* Preprocessing
|
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**6. Utilities**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2019-03-04 11:29:53 +01:00
|
|
|
* I/O Stream
|
|
|
|
* Filesystem Library
|
2020-03-01 12:50:30 +01:00
|
|
|
* Math Functions
|
2018-03-08 12:04:09 +01:00
|
|
|
* Algorithm Library
|
2020-03-01 12:50:30 +01:00
|
|
|
* `std::string` and `std::string_view`
|
2018-03-08 12:04:09 +01:00
|
|
|
* Random Numbers
|
|
|
|
* Time Measuring
|
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**7. C++ Object Oriented Programming I**
|
2019-03-04 11:29:53 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
* C++ Classes
|
|
|
|
* Class Constructor
|
2019-03-04 11:29:53 +01:00
|
|
|
* Copy Construcor
|
2020-03-01 12:50:30 +01:00
|
|
|
* Class Destructor
|
|
|
|
* Initialization and Defaulted Members
|
|
|
|
* Class Keywords
|
2019-03-04 11:29:53 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**8. C++ Object Oriented Programming II**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
* Polymorphism
|
2020-03-01 12:50:30 +01:00
|
|
|
* Operator overloading
|
|
|
|
** Special Objects
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**9. C++ Templates and Meta-programming I**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
* Function Templates
|
2020-03-01 12:50:30 +01:00
|
|
|
* Compile-Time Utilities
|
2018-03-08 12:04:09 +01:00
|
|
|
* Type Traits
|
|
|
|
* Template Parameters
|
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**10. C++ Templates and Meta-programming II**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
* Class Templates
|
|
|
|
* Template Meta-Programming
|
2020-03-01 12:50:30 +01:00
|
|
|
* SFINAE: Substitution Failure Is Not An Error
|
2018-03-08 12:04:09 +01:00
|
|
|
* Variadic Template
|
|
|
|
* STD Template Utility
|
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**11. Containers, Iterators, and Algorithms**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
* Containers and Iterators
|
2020-03-01 12:50:30 +01:00
|
|
|
* Sequence Containers: `array`, `vector`, `list`, `deque`, `forward_list`
|
|
|
|
* Associative Containers: `set`, `map`
|
|
|
|
* Container Adaptors: `stack`, `queue`, `priority_queue`
|
2018-03-08 12:04:09 +01:00
|
|
|
* Implement a Custom Iterator
|
|
|
|
* Iterator Utility Methods
|
|
|
|
* Algorithms Library
|
|
|
|
* Lambda Expressions
|
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**12. Translation Units**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
* Basic Concepts
|
|
|
|
* Linkage
|
2018-03-08 12:04:09 +01:00
|
|
|
* Variables Storage
|
2020-03-01 12:50:30 +01:00
|
|
|
* Function Template
|
|
|
|
* Class Template
|
|
|
|
* Undefined Behavior and Summary
|
|
|
|
* `#include` Issues
|
2018-03-08 12:04:09 +01:00
|
|
|
* Namespace
|
2020-03-01 12:50:30 +01:00
|
|
|
* How to Compile: static and dynamic libraries
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**13. Code Conventions**
|
2019-03-04 11:29:53 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
* C++ Project Organization
|
|
|
|
* Coding Styles and Conventions
|
|
|
|
* `#include` and `namespace`
|
|
|
|
* Variables and Prepossessing
|
|
|
|
* Functions and Classes
|
|
|
|
* Modern C++ Features
|
|
|
|
* Control Flow
|
|
|
|
* Naming and Formatting
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**14. Ecosystem**
|
2019-03-04 11:29:53 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
* Execution Debugging: `gdb` and `assert`
|
|
|
|
* Memory Debugging: `valgrind`
|
|
|
|
* Sanitizers: `address`, `leak`, `memory`, `undefined behavior`
|
|
|
|
* Debugging Summary
|
2018-03-08 12:04:09 +01:00
|
|
|
* CMake
|
2020-03-01 12:50:30 +01:00
|
|
|
* 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 `formating`, `exploring`, `benchmarking`
|
2018-03-08 12:04:09 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**15. Advanced Topics**
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
* Move Semantic
|
2020-03-01 12:50:30 +01:00
|
|
|
* Copy Elision and RVO
|
2019-03-04 11:29:53 +01:00
|
|
|
* Type deduction
|
2020-03-01 12:50:30 +01:00
|
|
|
* C++ Idioms: `rule of zero/three/five`, `singleton`, `PILP`, `CRTP`
|
2018-03-08 12:04:09 +01:00
|
|
|
* Smart Pointers
|
2020-03-01 12:50:30 +01:00
|
|
|
* Concurrency: `std::thread`
|
2019-03-04 11:29:53 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
**16. Optimization I**
|
2019-03-04 11:29:53 +01:00
|
|
|
|
2020-03-01 12:50:30 +01:00
|
|
|
* General Concepts: asymptotic complexity, optimization cycle, Ahmdal Law, etc.
|
2019-03-04 11:29:53 +01:00
|
|
|
* I/O Operations
|
2020-03-01 12:50:30 +01:00
|
|
|
* Locality and Memory Access Patterns
|
2019-03-04 11:29:53 +01:00
|
|
|
* Arithmetic
|
|
|
|
* Control Flow
|
|
|
|
* Functions
|
|
|
|
* C++ Objects
|
2020-03-01 12:50:30 +01:00
|
|
|
|
|
|
|
**17. Optimization II**
|
|
|
|
|
2019-03-04 11:29:53 +01:00
|
|
|
* Compiler Optimizations
|
|
|
|
* Libraries and Data Structures
|
|
|
|
* Profiling
|
|
|
|
* Parallel Computing
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
### Reporting bugs and contributing ###
|
|
|
|
|
|
|
|
If you find any typos please report them by using the repository
|
2019-03-04 11:29:53 +01:00
|
|
|
(**issues** panel).
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
## Author ##
|
|
|
|
|
2019-03-04 11:29:53 +01:00
|
|
|
* `Federico Busato`, Dept. of Computer Science, University of Verona (Italy) [federico.busato@univr.it](mailto:federico.busato@univr.it),
|
|
|
|
now Nvidia Corporation ([fbusato@nvidia.com](mailto:fbusato@nvidia.com))
|
2018-03-08 12:04:09 +01:00
|
|
|
|
|
|
|
## License ##
|
|
|
|
|
|
|
|
> BSD 3-Clause License
|
|
|
|
>
|
2020-03-01 12:50:30 +01:00
|
|
|
> Copyright (c) 2020, Modern C++ Programming
|
2018-03-08 12:04:09 +01:00
|
|
|
> 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.
|