Foreword |
|
xxi | |
Foreword to the First Edition |
|
xxix | |
Preface |
|
xxxi | |
I Tutorial Introduction to STL |
|
1 | (212) |
|
|
3 | (16) |
|
Who Should Read This Book |
|
|
4 | (1) |
|
What Generic Programming Is and Why It's Important |
|
|
4 | (3) |
|
How C++ Templates Enable Generic Programming |
|
|
7 | (8) |
|
The ``Code Bloat'' Problem with Templates |
|
|
15 | (1) |
|
Understanding STL's Performance Guarantees |
|
|
15 | (4) |
|
Overview of STL Components |
|
|
19 | (26) |
|
|
19 | (7) |
|
|
26 | (7) |
|
|
33 | (3) |
|
|
36 | (4) |
|
|
40 | (3) |
|
|
43 | (2) |
|
How STL Differs from Other Libraries |
|
|
45 | (4) |
|
|
46 | (1) |
|
Component Interchangeability |
|
|
46 | (2) |
|
Algorithm/Container Compatibility |
|
|
48 | (1) |
|
|
49 | (24) |
|
|
50 | (2) |
|
|
52 | (2) |
|
|
54 | (1) |
|
|
55 | (1) |
|
|
56 | (2) |
|
The STL Iterator Hierarchy: Combining Algorithms and Containers Efficiently |
|
|
58 | (1) |
|
|
59 | (3) |
|
Revisiting Input and Output: Stream Iterators |
|
|
62 | (2) |
|
Specification of Iterator Categories Required by STL Algorithms |
|
|
64 | (1) |
|
Designing Generic Algorithms |
|
|
65 | (2) |
|
Why Some Algorithms Require More Powerful Iterators |
|
|
67 | (1) |
|
Choosing the Right Algorithm |
|
|
68 | (1) |
|
Constant Versus Mutable Iterator Types |
|
|
68 | (3) |
|
Iterator Categories Provided by STL Containers |
|
|
71 | (2) |
|
|
73 | (54) |
|
Basic Algorithm Organization in STL |
|
|
73 | (4) |
|
Nonmutating Sequence Algorithms |
|
|
77 | (10) |
|
Mutating Sequence Algorithms |
|
|
87 | (15) |
|
Sorting-Related Algorithms |
|
|
102 | (20) |
|
Generalized Numeric Algorithms |
|
|
122 | (5) |
|
|
127 | (34) |
|
|
129 | (19) |
|
|
148 | (4) |
|
|
152 | (9) |
|
Sorted Associative Containers |
|
|
161 | (22) |
|
|
162 | (12) |
|
|
174 | (9) |
|
|
183 | (10) |
|
Passing Functions via Function Pointers |
|
|
184 | (2) |
|
Advantages of Specifying Function Objects with Template Parameters |
|
|
186 | (5) |
|
STL-Provided Function Objects |
|
|
191 | (2) |
|
|
193 | (8) |
|
|
194 | (2) |
|
|
196 | (2) |
|
Priority Queue Container Adaptor |
|
|
198 | (3) |
|
|
201 | (4) |
|
|
205 | (8) |
|
|
205 | (1) |
|
|
206 | (2) |
|
Adaptors for Pointers to Functions |
|
|
208 | (5) |
II Putting It Together: Example Programs |
|
213 | (80) |
|
Program for Searching a Dictionary |
|
|
215 | (10) |
|
Finding Anagrams of a Given Word |
|
|
215 | (3) |
|
Interacting with the Standard String and I/O Streams Classes |
|
|
218 | (2) |
|
Generating Permutations and Searching the Dictionary |
|
|
220 | (1) |
|
|
221 | (2) |
|
|
223 | (2) |
|
Program for Finding All Anagram Groups |
|
|
225 | (10) |
|
|
225 | (1) |
|
Defining a Data Structure to Work with STL |
|
|
226 | (1) |
|
Creating Function Objects for Comparisons |
|
|
227 | (1) |
|
Complete Anagram Group Finding Program |
|
|
228 | (1) |
|
Reading the Dictionary into a Vector of PS Objects |
|
|
229 | (1) |
|
Using a Comparison Object to Sort Word Pairs |
|
|
230 | (1) |
|
Using an Equality Predicate Object to Search for Adjacent Equal Elements |
|
|
230 | (1) |
|
Using a Function Adaptor to Obtain a Predicate Object |
|
|
231 | (1) |
|
Copying the Anagram Group to the Output Stream |
|
|
232 | (1) |
|
Output of the Anagram Program |
|
|
232 | (3) |
|
Better Anagram Program: Using the List and Map Containers |
|
|
235 | (8) |
|
Data Structure Holding Iterator Pairs |
|
|
235 | (1) |
|
Storing Information in a Map of Lists |
|
|
236 | (1) |
|
Outputting the Anagram Groups in Order of Size |
|
|
237 | (1) |
|
|
238 | (1) |
|
|
239 | (1) |
|
|
240 | (3) |
|
Faster Anagram Program: Using Multimaps |
|
|
243 | (8) |
|
Finding Anagram Groups, Version 3 |
|
|
243 | (3) |
|
Declaration of the Multimap |
|
|
246 | (1) |
|
Reading the Dictionary into the Multimap |
|
|
247 | (1) |
|
Finding the Anagram Groups in the Multimap |
|
|
247 | (2) |
|
Outputting the Anagram Groups in Order of Size |
|
|
249 | (1) |
|
|
249 | (1) |
|
|
250 | (1) |
|
Defining an Iterator Class |
|
|
251 | (8) |
|
New Kind of Iterator: Counting Iterator |
|
|
251 | (2) |
|
|
253 | (6) |
|
Combining STL with Object-Oriented Programming |
|
|
259 | (8) |
|
Using Inheritance and Virtual Functions |
|
|
260 | (5) |
|
Avoiding ``Code Bloat'' from Container Instances |
|
|
265 | (2) |
|
Program for Displaying Theoretical Computer Science Genealogy |
|
|
267 | (12) |
|
|
267 | (1) |
|
Associating Students with Advisors |
|
|
268 | (2) |
|
Finding the Roots of the Tree |
|
|
270 | (3) |
|
|
273 | (2) |
|
|
275 | (1) |
|
Complete ``Genealogy'' Program |
|
|
276 | (3) |
|
Class for Timing Generic Algorithms |
|
|
279 | (14) |
|
Obstacles to Accurate Timing of Algorithms |
|
|
279 | (1) |
|
|
280 | (3) |
|
|
283 | (1) |
|
Automated Analysis with a Timer Class |
|
|
284 | (5) |
|
Timing the STL Sort Algorithms |
|
|
289 | (4) |
III STL Reference Guide |
|
293 | (166) |
|
|
295 | (24) |
|
Input Iterator Requirements |
|
|
296 | (2) |
|
Output Iterator Requirements |
|
|
298 | (1) |
|
Forward Iterator Requirements |
|
|
299 | (1) |
|
Bidirectional Iterator Requirements |
|
|
299 | (1) |
|
Random Access Iterator Requirements |
|
|
300 | (1) |
|
|
301 | (3) |
|
|
304 | (1) |
|
|
304 | (3) |
|
|
307 | (2) |
|
|
309 | (4) |
|
|
313 | (2) |
|
|
315 | (1) |
|
|
316 | (3) |
|
Container Reference Guide |
|
|
319 | (68) |
|
|
319 | (11) |
|
Organization of the Container Class Descriptions |
|
|
330 | (1) |
|
|
331 | (8) |
|
|
339 | (6) |
|
|
345 | (9) |
|
|
354 | (6) |
|
|
360 | (5) |
|
|
365 | (8) |
|
|
373 | (5) |
|
|
378 | (2) |
|
|
380 | (3) |
|
Priority Queue Container Adaptor |
|
|
383 | (4) |
|
Generic Algorithm Reference Guide |
|
|
387 | (44) |
|
Organization of the Algorithm Descriptions |
|
|
387 | (2) |
|
Nonmutating Sequence Algorithm Overview |
|
|
389 | (1) |
|
|
390 | (1) |
|
|
391 | (1) |
|
|
391 | (1) |
|
|
392 | (1) |
|
|
393 | (1) |
|
|
394 | (1) |
|
|
395 | (1) |
|
|
396 | (1) |
|
|
397 | (1) |
|
|
397 | (1) |
|
Mutating Sequence Algorithm Overview |
|
|
398 | (1) |
|
|
399 | (1) |
|
|
400 | (1) |
|
|
401 | (1) |
|
|
402 | (1) |
|
|
403 | (1) |
|
|
404 | (1) |
|
|
404 | (2) |
|
|
406 | (1) |
|
|
407 | (1) |
|
|
408 | (1) |
|
|
408 | (1) |
|
|
409 | (1) |
|
Sorting-Related Algorithms Overview |
|
|
410 | (2) |
|
|
412 | (2) |
|
|
414 | (1) |
|
|
415 | (2) |
|
|
417 | (1) |
|
Set Operations on Sorted Structures |
|
|
418 | (3) |
|
|
421 | (2) |
|
|
423 | (1) |
|
Lexicographical Comparison |
|
|
424 | (1) |
|
|
425 | (1) |
|
Generalized Numeric Algorithms Overview |
|
|
426 | (1) |
|
|
427 | (1) |
|
|
428 | (1) |
|
|
429 | (1) |
|
|
430 | (1) |
|
Function Object and Function Adaptor Reference Guide |
|
|
431 | (10) |
|
|
431 | (1) |
|
|
432 | (1) |
|
|
433 | (1) |
|
|
433 | (1) |
|
|
434 | (1) |
|
|
435 | (1) |
|
|
435 | (1) |
|
Adaptors for Pointers to Functions |
|
|
436 | (1) |
|
Adaptors for Pointers to Member Functions |
|
|
437 | (4) |
|
Allocator Reference Guide |
|
|
441 | (14) |
|
|
441 | (1) |
|
|
442 | (3) |
|
|
445 | (3) |
|
|
448 | (7) |
|
Utilities Reference Guide |
|
|
455 | (4) |
|
|
455 | (1) |
|
|
455 | (1) |
|
|
456 | (3) |
Appendix A STL Header Files |
|
459 | (2) |
Appendix B String Reference Guide |
|
461 | (16) |
|
|
461 | (11) |
|
|
472 | (5) |
Appendix C STL Include Files Used in Example Programs |
|
477 | (6) |
|
C.1 Files Used in Example 17.1 |
|
|
477 | (6) |
Appendix D STL Resources |
|
483 | (2) |
|
D.1 Internet Addresses for SGI Reference Implementation of STL |
|
|
483 | (1) |
|
D.2 World Wide Web Address for Source Code for Examples in this Book |
|
|
483 | (1) |
|
D.3 STL-Compatible Compilers |
|
|
484 | (1) |
|
D.4 Other Related STL and C++ Documents |
|
|
484 | (1) |
|
D.5 Generic Programming and STL Discussion List |
|
|
484 | (1) |
References |
|
485 | (4) |
Index |
|
489 | |