Code Monkey home page Code Monkey logo

cpp-templates-2ed's Introduction

  • C++ 模板技术是泛型编程的核心,但囿于编译器技术限制,不得不带着缺陷诞生,语法晦涩,报错冗长,难以调试,应用层开发较少使用,相关技术书籍匮乏,因此掌握难度较大。模板相关的经典技术书籍主要有三本,分别是 2001 年出版的 Modern C++ Design、2002 年出版的 C++ Templates、2004 年出版的 C++ Template Metaprogramming。三者基于的 C++ 标准都是 C++98,Modern C++ Design 涉及 Andrei Alexandrescu 写书时配套的 LokiC++ Template Metaprogramming 涉及 Boost,二者以介绍元编程(模板技术的一种应用)为主,只有 C++ Templates 主要介绍 C++98 标准的模板技术。时过境迁,C++ 标准的更新逐步修复了一些语法缺陷,减少了使用者的心智负担,并引入了语法糖和工具,让编写模板越来越简单。2017 年 9 月 25 日,基于 C++17 标准,C++ Templates 2ed 出版,填补了十多年间模板技术进化时相关书籍的空白,堪称最全面的模板教程,也是对 C++11/14/17 特性介绍最为全面的书籍之一。个人完整学习原书后,梳理精简章节脉络,补充 C++20 相关特性,如 concepts、支持模板参数的 lambda 等,运行验证所有代码结果,最终记录至此。

Basics

  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

Designing

  1. Traits
  2. Overloading on type property
  3. Inheritance
  4. Bridging static and dynamic polymorphism
  5. Metaprogramming
  6. Typelist
  7. Tuple
  8. Variant
  9. Expression template
  10. Debugging

cpp-templates-2ed's People

Contributors

downdemo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.