YarikTH / Cpp-Templates-2ed

C++11/14/17/20 templates and generic programming, the most complex and difficult technical details of C++, indispensable in building infrastructure libraries.

Home Page:https://downdemo.github.io/Cpp-Templates-2ed/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disclaimer: This fork is an automatic English translation of the original project. Later godbolt links for each example can be provided, because it is easier to use

C++ template technology is the core of generic programming, but due to limitations of compiler technology, it had to be born with defects and obscure syntax. The error reporting is lengthy and difficult to debug, application layer development is rarely used, and relevant technical books are scarce, so it is difficult to master.

There are three main classic technical books related to templates, namely Modern C++ Design published in 2001 and C++ Templates published in 2002, C++ Template Metaprogramming published in 2004.

The C++ standards based on the three are all C++98, Modern C++ Design involves Andrei Alexandrescu when writing the book, supporting Loki, C++ Template Metaprogramming involves Boost, both of which mainly introduce metaprogramming (an application of template technology). Only C++ Templates mainly introduces the C++98 standard template technology.

As time goes by, updates to the C++ standard have gradually fixed some grammatical defects, reduced the mental burden on users, and introduced syntactic sugar and tools to make template writing easier and easier. On September 25, 2017, based on the C++17 standard, C++ Templates 2ed was published, filling in the relevant books on the evolution of template technology in more than ten years. It is the most comprehensive template tutorial and one of the most comprehensive books introducing the features of C++11/14/17. After personally studying the original book, I sorted out and streamlined the chapters and added C++20 related features, such as concepts, lambda that supports template parameters, etc., run to verify all codes As a result, this is the final record.

Contents

  1. Function template
  2. Class template
  3. Non-type template parameter
  4. Variadic template
  5. Move semantics and perfect forwarding
  6. Name lookup
  7. Instantiation
  8. Template argument deduction
  9. Specialization and overloading
  10. Traits
  11. Inheritance
  12. Type erasure
  13. Metaprogramming
  14. Expression template
  15. Debugging

About

C++11/14/17/20 templates and generic programming, the most complex and difficult technical details of C++, indispensable in building infrastructure libraries.

https://downdemo.github.io/Cpp-Templates-2ed/

License:Apache License 2.0


Languages

Language:C++ 100.0%