Skip to content

Guide · Open source

How to use modern-cpp-tutorial: read, clone and learn C++

Updated · written with AI from the project's own documentation and checked against our catalogue data

modern-cpp-tutorial is a free book, hosted on GitHub, that explains the features added to C++ from C++11 through C++26, with short code examples. It is written for readers who already know traditional C++ and want to catch up on newer features. After this guide you will know the reading options, where the code and exercises live, and how to build the project locally.

Modern C++ Tutorialchangkun/modern-cpp-tutorial · ★ 25.9k · MIT

Quick start

  1. 1Check you are the right reader. Confirm you already know traditional C++ before starting, since the book assumes that background.
  2. 2Pick a reading method. Choose the GitHub online table of contents, the PDF, the EPUB or the website.
  3. 3Find the feature you need. Use the table of contents to jump to the modern C++ feature you want to learn rather than reading in order.
  4. 4Clone the repository if you want local files. Run git clone https://github.com/changkun/modern-cpp-tutorial to get the code, exercises and website source.
  5. 5Run the code samples. Open the chapter folder in the code directory and compile the example that matches the feature.
  6. 6Build the site with Docker (optional). Install Docker, then run make build in the project folder to build everything locally.

Who is modern-cpp-tutorial for?

The book assumes you already know traditional C++ (C++98 or earlier), or that you can read traditional C++ code without difficulty. Experienced C++ developers who want a quick overview of modern features are the intended readers.

It is not a first programming course. The author also says it is not meant for advanced C++ mastery, since it offers a quick start and only introduces some advanced topics to a limited extent.

  • Good fit: experienced C++ developers, people migrating older codebases to modern C++ gradually, and readers who want to look up individual features as needed.
  • Poor fit: complete beginners to programming, and readers seeking advanced C++ mastery.

How to read modern-cpp-tutorial online or offline

The source lists several reading methods: the GitHub online table of contents, a PDF, an EPUB and a website. The website also adapts to mobile browsers.

You do not need to install anything to read the book. The author suggests reading only the features you need when you need them, because not all features are required.

  • GitHub online: the book's table of contents at book/en-us/toc.md in the repository.
  • PDF: modern-cpp-tutorial-en-us.pdf, linked from the project README.
  • EPUB: modern-cpp-tutorial-en-us.epub, linked from the project README.
  • Website: changkun.de/modern-cpp.

Clone the repository to get the source

If you want the files locally, clone the GitHub repository. The README gives this command for that step.

The repository also contains the code samples and exercise answers, organised by chapter. Each folder name is the chapter number.

  • Code samples are in the code folder.
  • Exercise answers are in the exercises folder. Each chapter ends with a few exercises to check your understanding.
  • The website source is in the website folder, built with hexo and vuejs.
git clone https://github.com/changkun/modern-cpp-tutorial

Build the site locally with Docker

If you want to build everything on your own machine, the README recommends using Docker. Install Docker first by following its official install guide, which the README links to.

Once Docker is set up, run the build command from the project folder.

$ make build

Use the book effectively

Do not read the book straight through as a single task. Pick the chapters that match the feature you are trying to understand, then run the matching code sample.

The book also explains the historical background of each feature, so you can see why it was introduced, not only how to write it. The author encourages readers to use modern C++ in new projects and to migrate older projects gradually.

  • Start from the table of contents and select the feature you need.
  • Read the historical background to understand the reason for the change.
  • Open the matching chapter folder in the code directory and compile the sample.
  • Try the chapter exercises and compare your answers with the exercises folder.

Report problems or contribute fixes

The author says the book was originally written in Chinese and that the author's language skills are limited. If you find mistakes or language problems, you can open an issue or a pull request on GitHub.

The README points to a contributing guide for the detailed process and checklist.

  • Report errors: open an issue at github.com/changkun/modern-cpp-tutorial/issues.
  • Suggest changes: open a pull request at github.com/changkun/modern-cpp-tutorial/pulls.
  • Read the guidelines: CONTRIBUTING.md in the repository.

What people use it for

  • Catching up on modern C++ features after years of writing traditional C++.
  • Looking up one feature, such as a specific addition from a given C++ standard, while working on a project.
  • Gradually migrating an older C++ codebase to modern C++ by learning the features as you need them.
  • Reviewing modern C++ concepts and testing yourself with the chapter exercises.
  • Reading offline on an e-reader or PDF viewer using the EPUB or PDF versions.

Frequently asked questions

Is modern-cpp-tutorial free?

Yes, the project describes itself as a free tutorial book. The code in the repository is under the MIT licence, while the book text is under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 licence.

What licence does modern-cpp-tutorial use?

The code of the repository is open sourced under the MIT licence. The book content is licensed under CC BY-NC-ND 4.0, which is non-commercial and does not allow derivatives.

What do I need to install to use modern-cpp-tutorial?

The install method is read-online, and the project lists no prerequisites. You can read the book in a browser without installing anything; cloning the repository and building the site with Docker are optional.

Do I need to know C++ before using this tutorial?

Yes. The book assumes you know traditional C++ (C++98 or earlier) or can read it without difficulty. It is not meant for complete beginners to programming.

Is modern-cpp-tutorial enough to master advanced C++?

No. The author says it offers a quick start for modern C++ and introduces some advanced topics only to a limited extent. Advanced readers can use it to review their knowledge.

What are the alternatives to modern-cpp-tutorial?

The source does not name any comparable projects, so this guide cannot recommend specific alternatives. Check whether the book covers the feature you need, and compare it with other resources yourself.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

modern-cpp-tutorial suits experienced C++ developers who want a free, quick overview of modern features, or who are migrating older code one feature at a time. Complete beginners and readers seeking advanced C++ mastery should pick a different resource.

Install options & downloads