Modern C++ Tutorial
This tutorial aims to provide experienced developers with a quick reference to the new features of C++11/14/17/20. It covers language usability enhancements, runtime improvements, new containers, smart pointers and memory management, regular expressions, concurrent programming, and a preview of C++20.
Course Overview
Content Summary
This tutorial is designed to provide experienced developers with a quick reference to the new features of C++11/14/17/20. The content covers language usability enhancements, runtime improvements, the use of new containers, smart pointers and memory management, regular expressions, concurrent programming, and a preview of C++20.
Quickly get up to speed with C++11/14/17/20 and step through the gateway to modern C++ programming.
Author: 欧长坤 (Ou Changkun)
Acknowledgments: 采用 CC BY-NC-ND 4.0 协议授权,致谢所有 GitHub 贡献者及相关社区支持。
Learning Objectives
- Identify and verify the C++ compiler environment and target architecture using command-line tools.
- Explain the standard compatibility and overlapping history between C (C89, C99, C11) and C++ (C++98, C++1x).
- Implement functional cross-language linking by using
extern "C"headers and multi-stage compilation workflows. - Resolve pointer ambiguity using
nullptrand implement compile-time logic usingconstexprandif constexpr. - Simplify complex declarations using
auto,decltype, and type aliasing (using) while ensuring robust object-oriented design withoverrideandfinal. - Design highly generic code using variadic templates, fold expressions, and non-type template parameter deduction.
- Define and implement Lambda expressions using various capture modes (Value, Reference, Expression, and Generic).
- Utilize
std::functionandstd::bindto create flexible function wrappers and partial function applications. - Categorize expressions into Lvalues, Prvalues, and Xvalues, and apply Move Semantics to optimize class resource management.
- Differentiate between the memory models and use cases of
std::array(fixed size, stack) andstd::vector(dynamic size, heap).