The C++ Standard Library
dyne-book
2
C++ Standard Library, The: A Tutorial and Reference
Many of the designations used by manufacturers and sellers to distinguish their products are
claimed as trademarks. Where those designations appear in this book and Addison Wesley
Longman Inc., was aware of a trademark claim, the designations have been printed in initial caps
or all caps.
The authors and publisher have taken care in the preparation of this book, but make no
expressed or implied warranty of any kind and assume no responsibility for errors or omissions.
No liability is assumed for incidental or consequential damages in connection with or arising out
of the use of the information or programs contained herein.
The publisher offers discounts on this book when ordered in quantity for special sales. For more
information, please contact:
AWL Direct Sales
Addison Wesley Longman, Inc
One Jacob Way
Reading, Massachusetts 01867
(781) 944-3700
Visit AW on the Web: www.awl.com/cseng/
Library of Congress Cataloging-in-Publication Data
Josuttis, Nicolai M.
The C++ standard library: a tutorial and reference / Nicolai M. Josuttis.
p. cm.
Includes bibliographical references and index.
1. C++ (Computer program language) I. Title.
QA76.73.C153J69 1999
005.13'3--dc21 99-24977
CIP
Copyright © 1999 by Addison Wesley Longman, Inc.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or
transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior consent of the publisher. Printed in the United States of America.
Published simultaneously in Canada.
1 2 3 4 5 6 7 8 9 -CRW- 0302010099
First printing, July 1999
The C++ Standard Library
dyne-book
3
Table of Contents
Preface
Acknowledgments
1. About this Book
1.1 Why this Book
1.2 What You Should Know Before Reading this Book
1.3 Style and Structure of the Book
1.4 How to Read this Book
1.5 State of the Art
1.6 Example Code and Additional Information
1.7 Feedback
2. Introduction to C++ and the Standard Library
2.1 History
2.2 New Language Features
2.3 Complexity and the Big-O Notation
3. General Concepts
3.1 Namespace std
3.2 Header Files
3.3 Error and Exception Handling
3.4 Allocators
4. Utilities
4.1 Pairs
4.1.1 Convenience Function make_pair()
4.1.2 Examples of Pair Usage
4.2 Class auto_ptr
4.3 Numeric Limits
4.4 Auxiliary Functions
4.5 Supplementary Comparison Operators
4.6 Header Files <cstddef> and <cstdlib>
5. The Standard Template Library
5.1 STL Components
5.2 Containers
5.3 Iterators
5.4 Algorithms
5.5 Iterator Adapters
5.6 Manipulating Algorithms
5.7 User-Defined Generic Functions
5.8 Functions as Algorithm Arguments
5.9 Function Objects
5.10 Container Elements
5.11 Errors and Exceptions Inside the STL
5.12 Extending the STL
6. STL Containers
6.1 Common Container Abilities and Operations
6.2 Vectors
6.3 Deques
The C++ Standard Library
dyne-book
4
6.4 Lists
6.5 Sets and Multisets
6.6 Maps and Multimaps
6.7 Other STL Containers
6.8 Implementing Reference Semantics
6.9 When to Use which Container
6.10 Container Types and Members in Detail
7. STL Iterators
7.1 Header Files for Iterators
7.2 Iterator Categories
7.3 Auxiliary Iterator Functions
7.4 Iterator Adapters
7.5 Iterator Traits
8. STL Function Objects
8.1 The Concept of Function Objects
8.2 Predefined Function Objects
8.3 Supplementary Composing Function Objects
9. STL Algorithms
9.1 Algorithm Header Files
9.2 Algorithm Overview
9.3 Auxiliary Functions
9.4 The for_each() Algorithm
9.5 Nonmodifying Algorithms
9.6 Modifying Algorithms
9.7 Removing Algorithms
9.8 Mutating Algorithms
9.9 Sorting Algorithms
9.10 Sorted Range Algorithms
9.11 Numeric Algorithms
10. Special Containers
10.1 Stacks
10.2 Queues
10.3 Priority Queues
10.4 Bitsets
11. Strings
11.1 Motivation
11.2 Description of the String Classes
11.3 String Class in Detail
12. Numerics
12.1 Complex Numbers
12.2 Valarrays
12.3 Global Numeric Functions
13. Input/Output Using Stream Classes
13. Input/Output Using Stream Classes
13.1 Common Background of I/O Streams
13.2 Fundamental Stream Classes and Objects
评论0