C++ 2024 (en)
C++ – The Comprehensive Guide (2024)
C++ – The Comprehensive Guide, 2024 Edition.
This is the translation of the german book C++ – Das umfassende Handbuch.
Here is an excerpt of the preface:
C++ continues to introduce modern features that enable new ways of working and idioms. Many sources on the internet still lean towards the C-like style, which has little to do with the capabilities of modern C++: RAII, Concepts, Modules, Coroutines, and Ranges. This book highlights the strengths of C++, especially where it outshines other languages.
This edition is based on a compiler that fully supports C++17. All common compilers also support C++20, and C++23 features are particularly emphasized, as compiler support for these is still not yet fully complete.
Some C++17 features used in the examples include:
- Template parameter deduction:
vector<int> data{1,2,3}
instead ofvector data{1,2,3}
- string_view: Use
const string&
instead ofstring_view
- Abbreviated function templates:
auto
in function parameters
AI tools can assist in everyday work, but you should remain skeptical of the answers they provide. These tools often mindlessly repeat what they find on the internet, and this can be dangerous. A presentation by Andrei Alexandrescu shows that AI tools will support us more and more, but we must stay vigilant.
These tools can be valuable aids, but they are no substitute for human judgment and expertise. Developers should use these tools with caution and critical thinking, fully aware of their limitations and risks. Only then can they leverage the benefits of AI technology without compromising the quality and integrity of their work.
Enjoy this book!
Listings
You find all listings in the downloads section from the publichers site. But I have them here for your convienience as well.
Errata
I will collect and publish important errata here, as they are discovered.
- Page 66
- The divisor “4” is missing.
Divisors of 100 are: 1, 2,
4,
5, 10, ...
- Page 79
- The middle listing should show
value
instead of.n
General
- I should have used
divisor
instead ofin listings consistently. The text often uses “divisor” correctly.divider
- I translated
instead ofbirthJahr
birthYear
in the text.