C++ Templates: The Complete Guide, 2/e (Hardcover)

David Vandevoorde, Nicolai M. Josuttis, Douglas Gregor

買這商品的人也買了...

相關主題

商品描述

Templates are among the most powerful features of C++, but they remain misunderstood and underutilized, even as the C++ language and development community have advanced. In C++ Templates, Second Edition, three pioneering C++ experts show why, when, and how to use modern templates to build software that’s cleaner, faster, more efficient, and easier to maintain.

 

Now extensively updated for the C++11, C++14, and C++17 standards, this new edition presents state-of-the-art techniques for a wider spectrum of applications. The authors provide authoritative explanations of all new language features that either improve templates or interact with them, including variadic templates, generic lambdas, class template argument deduction, compile-time if, forwarding references, and user-defined literals. They also deeply delve into fundamental language concepts (like value categories) and fully cover all standard type traits.

 

The book starts with an insightful tutorial on basic concepts and relevant language features. The remainder of the book serves as a comprehensive reference, focusing first on language details and then on coding techniques, advanced applications, and sophisticated idioms. Throughout, examples clearly illustrate abstract concepts and demonstrate best practices for exploiting all that C++ templates can do.

  • Understand exactly how templates behave, and avoid common pitfalls
  • Use templates to write more efficient, flexible, and maintainable software
  • Master today’s most effective idioms and techniques
  • Reuse source code without compromising performance or safety
  • Benefit from utilities for generic programming in the C++ Standard Library
  • Preview the upcoming concepts feature

The companion website, tmplbook.com, contains sample code and additional updates.

商品描述(中文翻譯)

模板是C++中最強大的功能之一,但它們仍然被誤解和未充分利用,即使C++語言和開發社區已經進步。在《C++ Templates, Second Edition》這本書中,三位開創性的C++專家展示了為什麼、何時以及如何使用現代模板來構建更乾淨、更快、更高效且更易於維護的軟體。

這本新版書已經廣泛更新,以符合C++11、C++14和C++17標準,並提供了更廣泛應用的最新技術。作者對所有改進模板或與之互動的新語言特性提供權威解釋,包括可變參數模板、通用lambda、類模板參數推斷、編譯時if、轉發引用和用戶自定義字面量。他們還深入探討了基本的語言概念(如值類別)並完整涵蓋了所有標準類型特性。

本書以深入的教程介紹基本概念和相關語言特性。書的其餘部分作為一本全面的參考書,首先關注語言細節,然後關注編碼技巧、高級應用和複雜的慣用語法。在整本書中,示例清晰地說明抽象概念並展示了充分利用C++模板的最佳實踐。


  • 準確理解模板的行為,避免常見陷阱

  • 使用模板編寫更高效、靈活且易於維護的軟體

  • 掌握當今最有效的慣用語法和技巧

  • 在不影響性能或安全性的情況下重複使用源代碼

  • 受益於C++標準庫中用於泛型編程的實用工具

  • 預覽即將推出的概念功能

附帶網站tmplbook.com提供示例代碼和其他更新。