没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
The C++ Standard Library
A Tutorial and Reference
Second Edition
Nicolai M. Josuttis
Upper Saddle
River, NJ • Boston • Indianapolis • San Francisco
New York • Toronto • Montreal • London • Munich • Paris • Madrid
Capetown • Sydney • Tokyo • Singapore • Mexico City
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 the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals.
The author 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 excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic
versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information,
please contact:
U.S.
Corporate and Government Sales
(800) 382-3419
corpsales@pearsontechgroup.com
For sales outside the United States, please contact:
International Sales
international@pearson.com
Visit us on the Web: informit.com/aw
Library of Congress Cataloging-in-Publication Data
Josuttis, Nicolai
M.
The
C++ standard library : a tutorial and reference / Nicolai M. Josuttis.—2nd ed.
p.
cm.
Includes bibliographical references and index.
ISBN
978-0-321-62321-8 (hardcover : alk. paper)
1.
C++ (Computer program language) I. Title.
QA76.73.C153J69
2012
005.13’3
-dc23
2011045071
Copyright © 2012 Pearson Education, Inc.
This book
was typeset by the author using the LATEX document processing system.
All
rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the
publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or likewise. To obtain permission to use material from this work, please submit a written request to Pearson Education,
Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to (201) 236-3290.
ISBN-13: 978-0-321-62321-8
ISBN-10:
0
-321-62321-5
Text printed
in the United States on recycled paper at Edwards Brothers in Ann Arbor, Michigan. First printing, March 2012
To those who care
for people and mankind
Contents
Preface to the Second Edition
Acknowledgments
for the Second Edition
Preface
to the First Edition
Acknowledgments
for the First Edition
1
About This Book
1.1 Why
This Book
1.2 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
of the C++ Standards
2.1.1 Common
Questions about the C++11 Standard
2.1.2 Compatibility
between C++98 and C++11
2.2 Complexity
and Big-O Notation
3
New Language Features
3.1 New
C++11 Language Features
3.1.1 Important
Minor Syntax Cleanups
3.1.2 Automatic
Type Deduction with
auto
3.1.3 Uniform
Initialization and Initializer Lists
3.1.4 Range
-Based
for Loops
3.1.5 Move
Semantics and Rvalue References
3.1.6 New
String Literals
3.1.7 Keyword
noexcept
3.1.8 Keyword
constexpr
3.1.9 New
Template Features
3.1.10 Lambdas
3.1.11 Keyword
decltype
3.1.12 New
Function Declaration Syntax
3.1.13 Scoped
Enumerations
3.1.14 New
Fundamental Data Types
3.2 Old
“New” Language Features
3.2.1 Explicit
Initialization for Fundamental Types
3.2.2 Definition
of
main()
4
General Concepts
4.1 Namespace
std
4.2 Header
Files
4.3 Error
and Exception Handling
4.3.1 Standard
Exception Classes
4.3.2 Members
of Exception Classes
4.3.3 Passing
Exceptions with Class
exception_ptr
4.3.4 Throwing
Standard Exceptions
4.3.5 Deriving
from Standard Exception Classes
4.4 Callable
Objects
4.5 Concurrency
and Multithreading
4.6 Allocators
5 Utilities
5.1 Pairs
and Tuples
5.1.1 Pairs
5.1.2 Tuples
5.1.3 I/O
for Tuples
5.1.4 Conversions
between
tuples and pairs
5.2 Smart
Pointers
5.2.1 Class
shared_ptr
5.2.2 Class
weak_ptr
5.2.3 Misusing
Shared Pointers
5.2.4 Shared
and Weak Pointers in Detail
5.2.5 Class
unique_ptr
5.2.6 Class
unique_ptr in Detail
5.2.7 Class
auto_ptr
5.2.8 Final Words
on Smart Pointers
5.3 Numeric
Limits
5.4 Type
Traits and Type Utilities
5.4.1 Purpose
of Type Traits
5.4.2 Type
Traits in Detail
5.4.3 Reference
Wrappers
5.4.4 Function
Type Wrappers
5.5 Auxiliary
Functions
5.5.1 Processing
the Minimum and Maximum
5.5.2 Swapping
Two Values
5.5.3 Supplementary
Comparison Operators
5.6 Compile
-Time Fractional Arithmetic with Class
ratio<>
5.7 Clocks
and Timers
5.7.1 Overview
of the Chrono Library
5.7.2 Durations
5.7.3 Clocks
and Timepoints
5.7.4 Date
and Time Functions by C and POSIX
5.7.5 Blocking
with Timers
5.8 Header
Files
<cstddef>, <cstdlib>, and <cstring>
5.8.1 Definitions
in
<cstddef>
5.8.2 Definitions
in
<cstdlib>
5.8.3 Definitions
in
<cstring>
6
The Standard Template Library
6.1 STL
Components
6.2 Containers
6.2.1 Sequence
Containers
6.2.2 Associative
Containers
6.2.3 Unordered
Containers
6.2.4 Associative
Arrays
6.2.5 Other
Containers
6.2.6 Container
Adapters
6.3 Iterators
6.3.1 Further
Examples of Using Associative and Unordered Containers
6.3.2 Iterator
Categories
6.4 Algorithms
6.4.1 Ranges
6.4.2 Handling
Multiple Ranges
6.5 Iterator
Adapters
6.5.1 Insert
Iterators
6.5.2 Stream Iterators
6.5.3 Reverse
Iterators
6.5.4 Move
Iterators
6.6 User
-Defined Generic Functions
6.7 Manipulating
Algorithms
6.7.1 “Removing”
Elements
6.7.2 Manipulating
Associative and Unordered Containers
6.7.3 Algorithms
versus Member Functions
6.8 Functions
as Algorithm Arguments
6.8.1 Using
Functions as Algorithm Arguments
6.8.2 Predicates
6.9 Using
Lambdas
6.10 Function
Objects
6.10.1 Definition
of Function Objects
6.10.2 Predefined
Function Objects
6.10.3 Binders
6.10.4 Function
Objects and Binders versus Lambdas
6.11 Container
Elements
6.11.1 Requirements
for Container Elements
6.11.2 Value
Semantics or Reference Semantics
6.12 Errors
and Exceptions inside the STL
6.12.1 Error
Handling
6.12.2 Exception
Handling
6.13 Extending
the STL
6.13.1 Integrating
Additional Types
6.13.2 Deriving
from STL Types
7
STL Containers
7.1 Common
Container Abilities and Operations
7.1.1 Container
Abilities
7.1.2 Container
Operations
7.1.3 Container
Types
7.2 Arrays
7.2.1 Abilities
of Arrays
7.2.2 Array
Operations
7.2.3 Using
arrays as C-Style Arrays
7.2.4 Exception
Handling
7.2.5 Tuple
Interface
7.2.6 Examples
of Using Arrays
7.3 Vectors
7.3.1 Abilities
of Vectors
7.3.2 Vector
Operations
7.3.3 Using
Vectors as C-Style Arrays
7.3.4 Exception
Handling
7.3.5 Examples
of Using Vectors
7.3.6 Class
vector<bool>
7.4 Deques
7.4.1 Abilities
of Deques
7.4.2 Deque
Operations
7.4.3 Exception
Handling
7.4.4 Examples
of Using Deques
7.5 Lists
7.5.1 Abilities
of Lists
7.5.2 List
Operations
剩余953页未读,继续阅读
ywwzq0507
- 粉丝: 28
- 资源: 11
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
- 4
- 5
- 6
前往页