STL Tutorial and Reference Guide - David R. Musser, Gillmer J. Derge, Atul Saini

STL Tutorial and Reference Guide

C++ Programming with the Standard Template Library
Buch | Hardcover
560 Seiten
2001 | 2nd edition
Addison Wesley (Verlag)
978-0-201-37923-5 (ISBN)
49,95 inkl. MwSt
  • Titel ist leider vergriffen;
    keine Neuauflage
  • Artikel merken
Covers more examples on how to use STL in a practical environment. This book is more concerned with performance and tools for its measurement.
"The second edition is clearer and adds more examples on how to use STL in a practical environment. Moreover, it is more concerned with performance and tools for its measurement. Both changes are very welcome."
--Lawrence Rauchwerger, Texas A&M University"So many algorithms, so little time! The generic algorithms chapter with so many more examples than in the previous edition is delightful! The examples work cumulatively to give a sense of comfortable competence with the algorithms, containers, and iterators used."
--Max A. Lebow, Software Engineer, Unisys Corporation 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.

You will find in-depth explanations of iterators, generic algorithms, containers, function objects, and much more. Several larger, non-trivial applications demonstrate how to put STL's power and flexibility to work. This book will also show you how to integrate STL with object-oriented programming techniques. In addition, the comprehensive and detailed STL reference guide will be a constant and convenient companion as you learn to work with the library.

This second edition is fully updated to reflect all of the changes made to STL for the final ANSI/ISO C++ language standard. It has been expanded with new chapters and appendices. 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. An accompanying Web site, including source code and examples referenced in the text, can be found at http://www.cs.rpi.edu/~musser/stl-book/index.html.



0201379236B05212001

David R. Musser, currently of Rensselaer Polytechnic Institute, has been involved with STL almost from its inception. Collaborating with its creator, Alexander Stepanov, he helped develop the first implementation and contributed to STL's inclusion in the ANSI/ISO C++ standard. Atul Saini is President and CEO of Modena Software Incorporated, which distributes STL++, the first commercial STL product. 0201379236AB04062001

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

Erscheint lt. Verlag 20.4.2001
Verlagsort Boston
Sprache englisch
Maße 195 x 240 mm
Gewicht 1315 g
Themenwelt Informatik Programmiersprachen / -werkzeuge C / C++
ISBN-10 0-201-37923-6 / 0201379236
ISBN-13 978-0-201-37923-5 / 9780201379235
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich
Das umfassende Handbuch

von Torsten T. Will

Buch | Hardcover (2024)
Rheinwerk (Verlag)
49,90
Technisch-wissenschaftliche Übungsaufgaben mit Lösungen

von Thomas Hoch; Gerd Küveler

Buch | Softcover (2023)
Springer Vieweg (Verlag)
37,99
das umfassende Handbuch

von Jürgen Wolf; René Krooß

Buch | Hardcover (2023)
Rheinwerk (Verlag)
49,90