Modern C++ Tutorial

现代 C++ 教程:高速上手 C++ 11/14/17/20。「📚 Modern C++ Tutorial: C++11/14/17/20 On the Fly」

Github stars Tracking Chart

现代 C++ 教程:高速上手 C++ 11/14/17/20

编者注:以下内容是根据项目的英文 readme、通过翻译软件翻译的。由于这本书本来是采用中文编写的,读者可直接访问欧先生网站阅读,网址:https://changkun.de/modern-cpp/

宗旨

本书自称是"高速上手"。其目的是全面介绍有关现代 C++(2020 年代以前)的相关特性。读者可以根据下面的内容表选择有趣的内容进行学习,快速熟悉你想学习的新特性。读者应注意,这些特性并非都是必须的。而是应该在你真正需要的时候再去学习。

同时,本书不是只介绍编码,而是介绍其技术需求的历史背景(尽量简单),这对理解这些功能为什么会出现有很大的帮助。

此外,笔者还想鼓励读者在阅读本书后,在新项目中直接使用现代 C++,并将自己的老项目逐步迁移到现代 C++。

读者对象

本书假设读者已经熟悉传统 C++(即 C++98 或更早的版本),或者至少在阅读传统 C++ 代码时没有任何困难。换句话说,那些有长期使用传统 C++ 经验的人和渴望在短时间内快速了解现代 C++ 特点的人都非常适合阅读本书。

本书在一定程度上介绍了现代 C++ 的黑魔法。但是,这些神奇的魔法非常有限,它们不适合想要学习高级 C++ 的读者。本书的目的是提供现代C++的快速入门。当然,高级读者也可以利用本书对现代 C++ 进行自我复习和检验。

起点

您可以从以下阅读方法中选择:

代码

这本书的每一章都包含许多代码。如果您在使用本书的介绍性功能编写自己的代码时遇到问题,阅读本书附带的源代码可能会有所帮助。你可以在这里找到这本书。所有代码按章节组织,文件夹名称为章节编号。

练习

这本书每章末尾都没有练习。这些是用来测试你是否掌握了本章的知识。你可以在这里找到这个问题的可能答案。同样,文件夹名是章节号。

网站

本书网站的源代码可以在这里找到,它是由 hexovuejs 构建的。该网站为您提供了另一种阅读方式,它也适用于移动浏览器。

构建

如果您对在本地构建所有内容感兴趣,建议使用 Docker。要构建,只需运行:

$ make build

致谢

这本书最初是 Changkun Ou 用中文写的。

作者的时间和语言能力有限。如果读者在书中发现任何错误或任何语言改进,请随时打开问题拉请求。有关详细的指南和检查表,请参阅如何投稿

作者感谢所有投稿人,包括但不限于投稿人

本项目还得到以下方面的支持:

许可证

Creative Commons License

这部作品由Ou Changkun撰写,并根据知识共享署名(Creative Commons Attribution)非商业性NoDerivatives 4.0国际许可证授权。这个存储库的代码是在麻省理工学院许可下开源的。


Overview

Name With Ownerchangkun/modern-cpp-tutorial
Primary LanguageC++
Program languageC++ (Language Count: 10)
PlatformLinux, Mac, Windows
License:MIT License
Release Count3
Last Release Namev2.0.0-beta (Posted on )
First Release Namev1.0.1 (Posted on 2018-03-30 08:42:29)
Created At2016-08-19 14:39:15
Pushed At2023-10-30 09:48:11
Last Commit At2023-05-07 15:19:09
Stargazers Count23.1k
Watchers Count637
Fork Count2.9k
Commits Count280
Has Issues Enabled
Issues Count118
Issue Open Count7
Pull Requests Count107
Pull Requests Open Count3
Pull Requests Close Count31
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

Modern C++ Tutorial: C++11/14/17/20 On the Fly

Purpose

The book claims "On the Fly". Its intent is to provide a comprehensive introduction to the relevant features regarding modern C++ (before 2020s).
Readers can choose interesting content according to the following table of content to learn and quickly familiarize the new features you would like to learn.
Readers should aware that all of these features are not required. It should be leart when you really need it.

At the same time, instead of grammar-only, the book introduces the historical background as simple as possible of its technical requirements, which provides great help in understanding why these features comes out.

In addition, The author would like to encourage that readers should be able to use modern C++ directly in their new projects and migrate their old projects to modern C++ gradually after read the book.

Targets

  • This book assumes that readers are already familiar with traditional C++ (i.e. C++98 or earlier), at least they do not have any difficulty in reading traditional C++ code. In other words, those who have long experience in traditional C++ and people who desire to quickly understand the features of modern C++ in a short period of time are well suited to read the book;

  • This book introduces to a certain extent of the dark magic of modern C++. However, these magics are very limited, they are not suitable for readers who want to learn advanced C++. The purpose of this book is offering a quick start for modern C++. Of course, advanced readers can also use this book to review and examine themselves on modern C++.

Start

You can choose from the following reading methods:

Code

Each chapter of this book has a lot of code. If you encounter problems when writing your own code with the introductory features of the book, you might as well read the source code attached to the book. You can find the book here. All the code organized by chapter, the folder name is the chapter number.

Exercises

There are few exercises At the end of each chapter of the book. It is for testing whether you can use the knowledge points in the current chapter. You can find the possible answer to the problem from here. The folder name is the chapter number.

Website

The source code of the website of this book can be found here, which is built by hexo and vuejs. The website provides you another way of reading the book, it is also adapts to mobile.

Build

If you are interested in build everything locally, it is recommended using Docker. To build, simply run:

$ make build

Acknowledgements

This book was originally written in Chinese by Changkun Ou.

The author has limited time and language skills. If readers find any mistakes of the book or any language improvements, please feel free to open an Issue or start a Pull request. For detailed guidelines and checklist, please refer to How to contribute.

The author would be grateful to all contributors, including but not limited to Contributors.

Licenses

This work was written by Ou Changkun and licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. The code of this repository is open sourced under the MIT license.

To the top