Exceptional C++ Style : 40 New Engineering Puzzles, Programming Problems, and Solutions

Herb Sutter

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

商品描述

Table of Contents:

Preface.

GENERIC PROGRAMMING AND THE C++ STANDARD LIBRARY.

1. Uses and Abuses of vector.

2. The String Formatters of Manor Farm, Part 1: sprintf.

3. The String Formatters of Manor Farm, Part 2: Standard (or Blindingly Elegant) Alternatives.

4. Standard Library Member Functions.

5. Flavors of Genericity, Part 1: Covering the Basis [sic].

6. Flavors of Genericity, Part 2: Generic Enough?

7. Why Not Specialize Function Templates?

8. Befriending Templates.

9. Export Restrictions, Part 1: Fundamentals.

10. Export Restrictions, Part 2: Interactions, Usability Issues, and Guidelines.

EXCEPTION SAFETY ISSUES AND TECHNIQUES.

11. Try and Catch Me.

12. Exception Safety: Is It Worth It?

13. A Pragmatic Look at Exception Specifications.

CLASS DESIGN, INHERITANCE, AND POLYMORPHISM.

14. Order, Order!

15. Uses and Abuses of Access Rights.

16. (Mostly) Private.

17. Encapsulation.

18. Virtuality.

19. Enforcing Rules for Derived Classes.

MEMORY AND RESOURCE MANAGEMENT.

20. Containers in Memory, Part 1: Levels of Memory Management.

21. Containers in Memory, Part 2: How Big Is It Really?

22. To new, Perchance to throw, Part 1: The Many Faces of new.

23. To new, Perchance to throw, Part 2: Pragmatic Issues in Memory Management.

OPTIMIZATION AND EFFICIENCY.

24. Constant Optimization?

25. inline Redux.

26. Data Formats and Efficiency, Part 1: When Compression Is the Name of the Game.

27. Data Formats and Efficiency, Part 2: (Even Less) Bit-Twiddling.

TRAPS, PITFALLS, AND PUZZLERS.

28. Keywords That Aren't (or, Comments by Another Name).

29. Is It Initialization?

30. double or Nothing.

31. Amok Code.

32. Slight Typos? Graphic Language and Other Curiosities.

33. Operators, Operators Everywhere.

STYLE CASE STUDIES.

34. Index Tables.

35. Generic Callbacks.

36. Construction Unions.

37. Monoliths "Unstrung," Part 1: A Look at std::string.

38. Monoliths "Unstrung," Part 2: Refactoring std::string.

39. Monoliths "Unstrung," Part 3: std::string Diminishing.

40. Monoliths "Unstrung," Part 4: std::string Redux.

Bibliography.

Index.

商品描述(中文翻譯)

目錄:

前言。
泛型編程和C++標準庫。
1. vector的使用和濫用。
2. Manor Farm的字符串格式化工具,第1部分:sprintf
3. Manor Farm的字符串格式化工具,第2部分:標準(或極其優雅)的替代方案。
4. 標準庫成員函數。
5. 泛型的不同風味,第1部分:涵蓋基礎。
6. 泛型的不同風味,第2部分:足夠泛型嗎?
7. 為什麼不專門化函數模板?
8. 為模板添加友元。
9. 出口限制,第1部分:基礎知識。
10. 出口限制,第2部分:交互作用、可用性問題和指南。

異常安全問題和技巧。
11. 嘗試和捕獲。
12. 異常安全:值得嗎?
13. 對異常規範的實用觀察。

類設計、繼承和多態性。
14. 順序,順序!
15. 訪問權限的使用和濫用。
16. (大部分)私有。
17. 封裝。
18. 虛擬性。
19. 強制派生類的規則。

內存和資源管理。
20. 內存中的容器,第1部分:內存管理的層次。
21. 內存中的容器,第2部分:它真的有多大?
22. 對new,也許是throw,第1部分:多種new的面貌。
23. 對new,也許是throw,第2部分:內存管理中的實用問題。

優化和效率。
24. 常量優化?
25. inline再探。
26. 數據格式和效率,第1部分:當壓縮是遊戲的名字。
27. 數據格式和效率,第2部分:(更少的)位操作。

陷阱、問題和謎題。
28. 不是關鍵字的關鍵字(或者,另一種形式的註釋)。
29. 它是初始化嗎?
30. double還是沒有。
31. 瘋狂的代碼。
32. 輕微的錯別字?圖形語言和其他奇特之處。
33. 遍地都是運算符。

風格案例研究。
34. 索引表。