STL Tutorial and Reference Guide: C++ Programming with the Standard, 2/e(Hardcover)
暫譯: STL 教程與參考指南:C++ 標準程式設計,第 2 版(精裝本)

David R. Musser, Gillmer J. Derge, Atul Saini

  • 出版商: Addison Wesley
  • 出版日期: 2001-04-06
  • 定價: $1,980
  • 售價: 9.0$1,782
  • 語言: 英文
  • 頁數: 560
  • 裝訂: Hardcover
  • ISBN: 0201379236
  • ISBN-13: 9780201379235
  • 相關分類: C++ 程式語言
  • 立即出貨(限量)

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

商品描述


Description

The STL Tutorial and Reference Guide is highly acclaimed as the most accessible, comprehensive, and practical introduction to the Standard Template Library (STL). Encompassing a set of C++ generic data structures and algorithms, STL provides reusable, interchangeable components adaptable to many different uses without sacrificing efficiency. Written by authors who have been instrumental in the creation and practical application of STL, STL Tutorial and Reference Guide, Second Edition includes a tutorial, a thorough description of each element of the library, numerous sample applications, and a comprehensive reference. Many new code examples throughout the book illustrate individual concepts and techniques, while larger sample programs demonstrate the use of the STL in real-world C++ software development.

Back to Top


Appropriate Courses

C++--Intermediate Programming.

Back to Top


Features

  • NEW!
Back to Top


Table Of Contents

Foreword.
Foreword to the First Edition.
Preface.

I. TUTORIAL INTRODUCTION TO STL.

1. Introduction.
Who Should Read This Book.
What Generic Programming Is and Why It's Important.
How C++ Templates Enable Generic Programming.
The "Code Bloat" Problem with Templates.
Understanding STL's Performance Guarantees.

2. Overview of STL Components.
Containers.
Generic Algorithms.
Iterators.
Function Objects.
Adaptors.
Allocators.

3. How STL Differs from Other Libraries.
Extensibility.
Component Interchangeability.
Algorithm/Container Compatibility.

4. Iterators.
Input Iterators.
Output Iterators.
Forward Iterators.
Bidirectional Iterators.
Random Access Iterators.
The STL Iterator Hierarchy: Combining Algorithms and Containers Efficiently.
Insert Iterators.
Revisiting Input and Output: Stream Iterators.
Specification of Iterator Categories Required by STL Algorithms.
Designing Generic Algorithms.
Why Some Algorithms Require More Powerful Iterators.
Choosing the Right Algorithm.
Constant Versus Mutable Iterator Types.
Iterator Categories Provided by STL Containers.

5. Generic Algorithms.
Basic Algorithm Organization in STL.
Nonmutating Sequence Algorithms.
Mutating Sequence Algorithms.
Sorting-Related Algorithms.
Generalized Numeric Algorithms.

6. Sequence Containers.
Vectors.
Deques.
Lists.

7. Sorted Associative Containers.
Sets and Multisets.
Maps and Multimaps.

8. Function Objects.
Passing Functions via Function Pointers.
Advantages of Specifying Function Objects with Template Parameters.
STL-Provided Function Objects.

9. Container Adaptors.
Stack Container Adaptor.
Queue Container Adaptor.
Priority Queue Container Adaptor.

10. Iterator Adaptors.
11. Function Adaptors.
Binders.
Negators.
Adaptors for Pointers to Functions.

II. PUTTING IT TOGETHER: EXAMPLE PROGRAMS.


12. Program for Searching a Dictionary.
Finding Anagrams of a Given Word.
Interacting with the Standard String and I/O Streams Classes.
Generating Permutations and Searching the Dictionary.
Complete Program.
How Fast Is It?

13. Program for Finding All Anagram Groups.
Finding Anagram Groups.
Defining a Data Structure to Work with STL.
Creating Function Objects for Comparisons.
Complete Anagram Group Finding Program.
Reading the Dictionary into a Vector of PS Objects.
Using a Comparison Object to Sort Word Pairs.
Using an Equality Predicate Object to Search for Adjacent Equal Elements.
Using a Function Adaptor to Obtain a Predicate Object.
Copying the Anagram Group to the Output Stream.
Output of the Anagram Program.

14. Better Anagram Program: Using the List and Map Containers.
Data Structure Holding Iterator Pairs.
Storing Information in a Map of Lists.
Outputting the Anagram Groups in Order of Size.
Better Anagram Program.
Output of the Program.
Why Use a Map Container?

15. Faster Anagram Program: Using Multimaps.
Finding Anagram Groups, Version 3.
Declaration of the Multimap.
Reading the Dictionary into the Multimap.
Finding the Anagram Groups in the Multimap.
Outputting the Anagram Groups in Order of Size.
Output of the Program.
How Fast Is It?

16. Defining an Iterator Class.
New Kind of Iterator: Counting Iterator.
Counting Iterator Class.

17. Combining STL with Object-Oriented Programming.
Using Inheritance and Virtual Functions.
Avoiding "Code Bloat" from Container Instances.

18. Program for Displaying Theoretical Computer Science Genealogy.
Sorting Students by Date.
Associating Students with Advisors.
Finding the Roots of the Tree.
Reading the File.
Printing the Results.
Complete "Genealogy" Program.

19. Class for Timing Generic Algorithms.
Obstacles to Accurate Timing of Algorithms.
Overcoming the Obstacles.
Refining the Approach.
Automated Analysis with a Timer Class.
Timing the STL Sort Algorithms.

III. STL REFERENCE GUIDE.


20. Iterator Reference Guide.
Input Iterator Requirements.
Output Iterator Requirements.
Forward Iterator Requirements.
Bidirectional Iterator Requirements.
Random Access Iterator Requirements.
Iterator Traits.
Iterator Operations.
Istream Iterators.
Ostream Iterators.
Reverse Iterators.
Back Insert Iterators.
Front Insert Iterators.
Insert Iterators.

21. Container Reference Guide.
Requirements.
Organization of the Container Class Descriptions.
Vector.
Deque.
List.
Set.
Multiset.
Map.
Multimap.
Stack Container Adaptor.
Queue Container Adaptor.
Priority Queue Container Adaptor.

22. Generic Algorithm Reference Guide.
Organization of the Algorithm Descriptions.
Nonmutating Sequence Algorithm Overview.
For Each.
Find.
Find First.
Adjacent Find.
Count.
Mismatch.
Equal.
Search.
Search N.
Find End.
Mutating Sequence Algorithm Overview.
Copy.
Swap.
Transform.
Replace.
Fill.
Generate.
Remove.
Unique.
Reverse.
Rotate.
Random Shuffle.
Partition.
Sorting-Related Algorithms Overview.
Sort.
Nth Element.
Binary Search.
Merge.
Set Operations on Sorted Structures.
Heap Operations.
Min and Max.
Lexicographical Comparison.
Permutation Generators.
Generalized Numeric Algorithms Overview.
Accumulate.
Inner Product.
Partial Sum.
Adjacent Difference.

23. Function Object and Function Adaptor Reference Guide.
Requirements.
Base Classes.
Arithmetic Operations.
Comparison Operations.
Logical Operations.
Negator Adaptors.
Binder Adaptors.
Adaptors for Pointers to Functions.
Adaptors for Pointers to Member Functions.

24. Allocator Reference Guide.
Introduction.
Allocator Requirements.
Default Allocator.
Custom Allocators 448

25. Utilities Reference Guide.
Introduction.
Comparison Functions.
Pairs.

Appendix A: STL Header Files.
Appendix B: String Reference Guide.
String Classes.
Character Traits.

Appendix C: STL Include Files Used in Example Programs.
Files Used in Example 17.1.

Appendix D: STL Resources.
Internet Addresses for SGI Reference Implementation of ST.
World Wide Web Address for Source Code for Examples in this Book.
STL-Compatible Compilers.
Other Related STL and C++ Documents.
Generic Programming and STL Discussion List.

References.
Index. 0201379236T04062001


Back to Top

商品描述(中文翻譯)

描述
《STL 教程與參考指南》被廣泛讚譽為最易於理解、全面且實用的標準模板庫(Standard Template Library, STL)入門書籍。STL 包含一組 C++ 的通用資料結構和演算法,提供可重用、可互換的元件,適用於多種不同的用途而不犧牲效率。這本書的作者在 STL 的創建和實際應用中發揮了重要作用,《STL 教程與參考指南,第二版》包括了一個教程、對庫中每個元素的詳細描述、眾多範例應用以及全面的參考資料。書中許多新的程式碼範例說明了各個概念和技術,而較大的範例程式則展示了 STL 在實際 C++ 軟體開發中的使用。

適合的課程
C++--中級程式設計。

特點
- 新增!

目錄
- 前言
- 第一版前言
- 序言
- I. STL 的教程介紹
1. 介紹
- 誰應該閱讀這本書
- 什麼是通用程式設計及其重要性
- C++ 模板如何實現通用程式設計
- 模板的「程式碼膨脹」問題
- 理解 STL 的性能保證
2. STL 元件概述
- 容器
- 通用演算法
- 迭代器
- 函數物件
- 適配器
- 配置器
3. STL 與其他庫的不同之處
- 可擴展性
- 元件互換性
- 演算法/容器相容性
4. 迭代器
- 輸入迭代器
- 輸出迭代器
- 前向迭代器
- 雙向迭代器
- 隨機存取迭代器
- STL 迭代器層級:有效結合演算法和容器
- 插入迭代器
- 重新檢視輸入和輸出:串流迭代器
- STL 演算法所需的迭代器類別規範
- 設計通用演算法
- 為什麼某些演算法需要更強大的迭代器
- 選擇正確的演算法
- 常量與可變迭代器類型
- STL 容器提供的迭代器類別
5. 通用演算法
- STL 中的基本演算法組織
- 不變序列演算法
- 變異序列演算法
- 與排序相關的演算法
- 一般化數值演算法
6. 序列容器
- 向量
- 雙端佇列
- 列表
7. 排序關聯容器
- 集合和多重集合
- 映射和多重映射
8. 函數物件
- 通過函數指標傳遞函數
- 使用模板參數指定函數物件的優勢
- STL 提供的函數物件
9. 容器適配器
- 堆疊容器適配器
- 佇列容器適配器
- 優先佇列容器適配器
10. 迭代器適配器
11. 函數適配器
- 綁定器
- 否定器
- 函數指標的適配器
- II. 整合範例程式
12. 搜尋字典的程式
- 尋找給定單字的變位詞
- 與標準字串和 I/O 流類互動
- 生成排列並搜尋字典
- 完整程式
- 它有多快?
13. 尋找所有變位詞組的程式
- 尋找變位詞組
- 定義與 STL 一起使用的資料結構
- 創建用於比較的函數物件
- 完整的變位詞組尋找程式
- 將字典讀入 PS 物件的向量中
- 使用比較物件對單字對進行排序
- 使用相等謂詞物件搜尋相鄰的相等元素
- 使用函數適配器獲取謂詞物件
- 將變位詞組複製到輸出流中
- 變位詞程式的輸出
14. 更好的變位詞程式:使用列表和映射容器
- 持有迭代器對的資料結構
- 在列表的映射中儲存資訊
- 按大小輸出變位詞組
- 更好的變位詞程式
- 程式的輸出
- 為什麼使用映射容器?
15. 更快的變位詞程式:使用多重映射
- 尋找變位詞組,版本 3
- 多重映射的宣告
- 將字典讀入多重映射中
- 在多重映射中尋找變位詞組
- 按大小輸出變位詞組
- 程式的輸出
- 它有多快?
16. 定義迭代器類
- 新型迭代器:計數迭代器
- 計數迭代器類
17. 將 STL 與物件導向程式設計結合
- 使用繼承和虛擬函數
- 避免來自容器實例的「程式碼膨脹」
18. 顯示理論計算機科學家譜系的程式
- 按日期排序學生
- 將學生與導師關聯
- 尋找樹的根
- 讀取檔案
- 列印結果
- 完整的「譜系」程式
19. 計時通用演算法的類
- 準確計時演算法的障礙
- 克服障礙
- 精煉方法
- 使用計時器類進行自動分析
- 計時 STL 排序演算法
- III. STL 參考指南
20. 迭代器參考指南
- 輸入迭代器要求
- 輸出迭代器要求
- 前向迭代器要求
- 雙向迭代器要求
- 隨機存取迭代器要求
- 迭代器特性
- 迭代器操作
- Istream 迭代器
- Ostream 迭代器
- 反向迭代器
- 後插入迭代器
- 前插入迭代器
- 插入迭代器
21. 容器參考指南
- 要求
- 容器類描述的組織
- 向量
- 雙端佇列
- 列表
- 集合
- 多重集合
- 映射
- 多重映射
- 堆疊容器適配器
- 佇列容器適配器
- 優先佇列容器適配器
22. 通用演算法參考指南
- 演算法描述的組織
- 不變序列演算法概述
- For Each
- Find
- Find First
- Adjacent Find
- Count
- Mismatch
- Equal
- Search
- Search N
- Find End
- 變異序列演算法概述
- Copy
- Swap
- Transform
- Replace
- Fill
- Generate
- Remove
- Unique
- Reverse
- Rotate
- Random Shuffle
- Partition
- 與排序相關的演算法概述
- Sort
- Nth Element
- Binary Search
- Merge
- 在排序結構上的集合操作
- 堆操作
- Min 和 Max
- 字典序比較
- 排列生成器
- 一般化數值演算法概述
- Accumulate
- Inner Product
- Partial Sum
- Adjacent Difference
23. 函數物件和函數適配器參考指南
- 要求
- 基類
- 算術運算
- 比較運算
- 邏輯運算
- 否定器適配器
- 綁定器適配器
- 函數指標的適配器
- 成員函數指標的適配器
24. 配置器參考指南
- 介紹
- 配置器要求
- 預設配置器
- 自定義配置器
25. 工具參考指南
- 介紹
- 比較函數
- 對

附錄 A: STL 標頭檔
附錄 B: 字串參考指南
字串類
字元特性

附錄 C: 範例程式中使用的 STL 包含檔
範例 17.1 中使用的檔案

附錄 D: STL 資源
SGI 參考實作的網路地址
本書範例的原始碼的全球資訊網地址
STL 相容的編譯器
其他相關的 STL 和 C++ 文件
通用程式設計和 STL 討論列表

參考文獻
索引