Preface
Preface to the Third Edition
Preface to Second Edition
Preface to First Edition
1 Notes to the Reader
1.1 The Structure of This Book2 A Tour of C++: The Basics (DRAFT)
1.1.1 Introduction1.2 The Design of C++
1.1.2 Basic Facilities
1.1.3 Abstraction Mechanisms
1.1.4 The Standard Library
1.1.5 Examples and References
1.2.1 Programming Style1.3 Learning C++
1.2.2 Type Checking
1.2.3 C Compatibility
1.2.4 Language, Libraries, and Systems
1.3.1 Programming in C++1.4 History
1.3.2 Suggestions for C++ Programmers
1.3.3 Suggestions for C Programmers
1.3.4 Suggestions for Java Programmers
1.4.1 Timeline1.5 Advice
1.4.2.1 Language Features and Library Facilities1.4.2 The Early Years
1.4.3.1 Language Features1.4.3 The 1998 Standard
1.4.3.2 The Standard Library
1.4.4.1 Language Features1.4.4 The 2011 Standard
1.4.4.2 Standard Library
1.4.5 What is C++ used for?
1.6 References
2.1 Introduction3 A Tour of C++: Abstraction Mechanisms (DRAFT)
2.2.1 Hello, World!2.2 The Basics
2.2.2 Types, Variables, and Arithmetic
2.2.3 Constants
2.2.4 Tests and Loops
2.2.5 Pointers, Arrays, and Loops
2.3.1 Structures2.3 User-Defined Types
2.3.2 Classes
2.3.3 Enumerations
2.4.1 Separate Compilation2.4 Modularity
2.4.2 Namespaces
2.4.3.1 Exceptions2.4.3 Error Handling
2.4.3.2 Invariants
2.4.3.3 Static Assertions
2.5 Postscript
2.6 Advice
3.1 Introduction4 A Tour of C++: Containers and Algorithms (DRAFT)
3.2 Classes
3.2.1 Concrete Types3.3 Copy and Move
3.2.1.1 An Arithmetic Type3.2.2 Abstract Types
3.2.1.2 A Container
3.2.1.3 Initializing Containers
3.2.3 Virtual Functions
3.2.4 Class Hierarchies
3.3.1 Copying Containers3.4 Templates
3.3.2 Moving Containers
3.3.3 Resource Management
3.3.4 Suppressing Operations
3.4.1 Parameterized Types3.5 Advice
3.4.2 Function Templates
3.4.3 Function Objects
3.4.4 Variadic Templates
3.4.5 Aliases
4.1 Libraries5 A Tour of C++: Concurrency and Utilities (DRAFT)
4.1.1 Standard-Library Overview4.2 Strings
4.1.2 The Standard-library Headers and Namespace
4.3 Stream I/O
4.3.1 Output4.4 Containers
4.3.2 Input
4.3.3 I/O of User-Defined Types
4.4.1 vector4.5 Algorithms
4.4.1.1 Elements4.4.2 list
4.4.1.2 Range Checking
4.4.3 map
4.4.4 unordered_map
4.4.5 Container Overview
4.5.1 Use of Iterators4.6 Advice
4.5.2 Iterator Types
4.5.3 Stream Iterators
4.5.4 Predicates
4.5.5 Algorithm Overview
4.5.6 Container Algorithms
5.1 Introduction
5.2 Resource Management
5.2.1 shared_ptr5.3 Concurrency
5.3.1 Tasks and threads
5.3.2 Passing Arguments
5.3.3 Returning Results
5.3.4.1 Waiting for Events5.3.4 Sharing Data
5.3.5 Communicating Tasks
5.3.5.1 promise
5.3.5.2 packaged_task
5.3.5.3 async()
5.4 Small Utility Components
5.4.1 Time5.5 Regular Expressions
5.4.2 Type Functions
5.4.2.1 iterator_traits5.4.3 tuple
5.4.2.2 Type Predicates
5.6 Math
5.6.1 Mathematical Functions and Algorithms5.7 Advice
5.6.2 Complex Numbers
5.6.3 Random Numbers
5.6.4 Vector Arithmetic
5.6.5 Numeric Limits
6 Types and Declarations
6.1 The ISO C++ Standard7 Pointers, Arrays, and References
6.1.1 Implementations6.2 Types
6.1.2 The Basic Source Character Set
6.2.1 Fundamental Types6.3 Declarations
6.2.2 Booleans
6.2.3 Character Types
6.2.3.1 Signed and Unsigned Characters6.2.4 Integer Types
6.2.3.2 Character Literals
6.2.4.1 Integer Literals6.2.5 Floating-Point Types
6.2.4.2 Types of Integer Literals
6.2.5.1 Floating-Point Literals6.2.6 Prefixes and Suffixes
6.2.7 void
6.2.8 Sizes
6.2.9 Alignment
6.3.1 The Structure of Declarations6.4 Objects and Values
6.3.2 Declaring Multiple Names
6.3.3.1 Keywords6.3.3 Names
6.3.4 Scope
6.3.5 Initialization
6.3.5.1 Missing Initializers6.3.6 Deducing a Type: decltype()
6.3.5.2 Initializer Lists
6.3.6.1 The auto Type Specifier
6.3.6.2 {}-lists
6.3.6.3 The decltype() Specifier
6.4.1 Lvalues and Rvalues6.5 Type Aliases
6.4.2 Lifetimes of Objects
6.6 Advice
7.1 Introduction8 Structures, Unions, and Enumerations
7.2 Pointers
7.2.1 void*7.3 Arrays
7.2.2 nullptr
7.3.1 Array Initializers7.4 Pointers into Arrays
7.3.2.1 Raw Character Strings7.3.2 String Literals
7.3.2.2 Larger Character Sets
7.4.1 Navigating Arrays7.5 Pointers and const
7.4.2 Multidimensional Arrays
7.4.3 Passing Arrays
7.6 Pointers and Ownership
7.7 References
7.7.1 Lvalue References7.8 Advice
7.7.2 Rvalue References
7.7.3 References to References
7.7.4 Pointers and References
8.1 Introduction9 Statements
8.2 Structures
8.2.1 struct Layout8.3 Unions
8.2.2 struct Names
8.2.3 Structures and Classes
8.2.4 Structures and Arrays
8.2.5 Type Equivalence
8.2.6 Plain Old Data
8.2.7 Fields
8.3.1 Unions and Classes8.4 Enumerations
8.3.2 Anonymous \f(Cw\m[blue]union\m[]\fPs
8.4.1 enum classes8.5 Advice
8.4.2 Plain enums
8.4.3 Unnamed enums
9.1 Introduction10 Expressions
9.2 Statement Summary
9.3 Declarations as Statements
9.4 Selection Statements
9.4.1 if Statements9.5 Iteration Statements
9.4.2.1 Declarations in Cases9.4.2 switch Statements
9.4.3 Declarations in Conditions
9.5.1 Range-for Statements9.6 goto Statements
9.5.2 for Statements
9.5.3 while Statements
9.5.4 do Statements
9.5.5 Loop Exit
9.7 Comments and Indentation
9.8 Advice
10.1 Introduction11 Select Operations
10.2.1 The Parser10.2 A Desk Calculator
10.2.2 Input
10.2.3 Low-Level Input
10.2.4 Error Handling
10.2.5 The Driver
10.2.6 Headers
10.2.7 Command-Line Arguments
10.2.8 A Note on Style
10.3 Operator Summary
10.3.1 Results10.4 Constant Expressions
10.3.2 Order of Evaluation
10.3.3 Operator Precedence
10.3.4 Temporary Objects
10.4.1 Symbolic Constants10.5 Implicit Type Conversion
10.4.2 consts in Constant Expressions
10.4.3 Literal Types
10.4.5 Address Constant Expressions
10.5.1 Promotions10.6 Advice
10.5.2 Conversions
10.5.2.1 Integral Conversions10.5.3 Usual Arithmetic Conversions
10.5.2.2 Floating-Point Conversions
10.5.2.3 Pointer and Reference Conversions
10.5.2.4 Pointer-to-Member Conversions
10.5.2.5 Boolean Conversions
10.5.2.6 Floating-Integral Conversions
11.1 Etc. Operators12 Functions
11.1.1 Logical Operators11.2 Free Store
11.1.2 Bitwise Logical Operators
11.1.3 Conditional Expressions
11.1.4 Increment and Decrement
11.2.1 Memory Management11.3 Lists
11.2.2 Arrays
11.2.3 Getting Memory Space
11.2.4 Overloading new
11.2.4.1 new
11.3.1 Implementation Model11.4 Lambda Expressions
11.3.2 Qualified Lists
11.3.3 Unqualified Lists
11.4.1 Implementation Model11.5 Explicit Type Conversion
11.4.2 Alternatives to Lambdas
11.4.3 Capture
11.4.3.1 Lambda and Lifetime11.4.4 Call and Return
11.4.3.2 Namespace Names
11.4.3.3 Lambda and this
11.4.3.4 mutable Lambdas
11.4.5 The Type of a Lambda
11.5.1 Construction11.6 Advice
11.5.2 Named Casts
11.5.3 C-Style Cast
11.5.4 Function-Style Cast
12.1 Function Declarations13 Exception Handling
12.1.1 Why Functions?12.2 Argument Passing
12.1.2 Parts of a Function Declaration
12.1.3 Function Definitions
12.1.4 Returning Values
12.1.5 inline Functions
12.1.6 constexpr Functions
12.1.6.1 constexpr and References12.1.7 [[noreturn]] Functions
12.1.6.2 Conditional Evaluation
12.1.8 Local Variables
12.2.1 Reference Arguments12.3 Overloaded Functions
12.2.2 Array Arguments
12.2.3 List Arguments
12.2.4 Unspecified Number of Arguments
12.2.5 Default Arguments
12.3.1 Automatic Overload Resolution12.4 Pre- and Postconditions
12.3.2 Overloading and Return Type
12.3.3 Overloading and Scope
12.3.4 Resolution for Multiple Arguments
12.3.5 Manual Overload Resolution
12.5 Pointer to Function
12.6 Macros
12.6.1 Conditional Compilation12.7 Advice
12.6.2 Predefined Macros
12.6.3 Pragmas
13.1 Error Handling14 Namespaces
13.1.1 Exceptions13.2 Exception Guarantees
13.1.2 Traditional Error Handling
13.1.3 Muddling Through
13.1.4 Alternative Views of Exceptions
13.1.4.1 Asynchronous Events13.1.5 When You Can't Use Exceptions
13.1.4.2 Exceptions That Are Not Errors
13.1.6 Hierarchical Error Handling
13.1.7 Exceptions and Efficiency
13.3 Resource Management
13.3.1 Finally13.4 Enforcing Invariants
13.5 Throwing and Catching Exceptions
13.5.1 Throwing Exceptions13.6 A vector Implementation
13.5.1.1 noexcept Functions13.5.2 Catching Exceptions
13.5.1.2 The noexcept Operator
13.5.1.3 Exception Specifications
13.5.2.1 Rethrow13.5.3 Exceptions and Threads
13.5.2.2 Catch Every Exception
13.5.2.3 Multiple Handlers
13.5.2.4 Function try-Blocks
13.5.2.5 Termination
13.6.1 A Simple vector13.7 Advice
13.6.2 Representing Memory Explicitly
13.6.3 Assignment
13.6.4 Changing Size
13.6.4.1 reserve()
13.6.4.2 resize()
13.6.4.3 push_back()
13.6.4.4 Final Thoughts
14.1 Composition Problems15 Source Files and Programs
14.2 Namespaces
14.2.1 Explicit Qualification14.3 Modularization and Interfaces
14.2.2 using-Declarations
14.2.3 using-Directives
14.2.4 Argument-Dependent Lookup
14.2.5 Namespaces Are Open
14.3.1 Namespaces as Modules14.4 Composition Using Namespaces
14.3.2 Implementations
14.3.3 Interfaces and Implementations
14.4.4 Composition and Selection14.5 Advice
14.4.1 Convenience vs. Safety
14.4.2 Namespace Aliases
14.4.3 Namespace Composition
14.4.5 Namespaces and Overloading
14.4.6 Versioning
14.4.7 Nested Namespaces
14.4.8 Unnamed Namespaces
14.4.9 C Headers
15.1 Separate Compilation
15.2 Linkage
15.2.1 File-Local Names15.3 Using Header Files
15.2.2 Header Files
15.2.3 The One-Definition Rule
15.2.4 Standard-Library Headers
15.2.5 Linkage to Non-C++ Code
15.2.6 Linkage and Pointers to Functions
15.3.1 Single-Header Organization15.4 Programs
15.3.2 Multiple-Header Organization
15.3.2.1 Other Calculator Modules15.3.3 Include Guards
15.3.2.2 Use of Headers
15.4.1 Initialization of Nonlocal Variables15.5 Advice
15.4.2 Initialization and Concurrency
15.4.3 Program Termination
16 Classes
16.1 Introduction17 Construction, Cleanup, Copy, and Move
16.2 Class Basics
16.2.1 Member Functions16.3 Concrete Classes
16.2.2 Default Copying
16.2.3 Access Control
16.2.4 struct
16.2.5 Constructors
16.2.6 explicit Constructors
16.2.7 In-Class Initializers
16.2.8 In-Class Function Definitions
16.2.9 Mutability
16.2.9.1 Constant Member Functions16.2.10 Self-Reference
16.2.9.2 Physical and Logical Constness
16.2.9.3 mutable
16.2.9.4 Mutability through Indirection
16.2.11 Member Access
16.2.12 [static] Members
16.2.13 Member Types
16.3.1 Member Functions16.4 Advice
16.3.2 Helper Functions
16.3.3 Overloaded Operators
16.3.4 The Significance of Concrete Classes
17.1 Introduction18 Operator Overloading
17.2 Constructors and Destructors
17.2.1 Constructors and Invariants17.3 Class Object Initialization
17.2.2 Destructors and Resources
17.2.3 Base and Member Destructors
17.2.4 Calling Constructors and Destructors
17.2.5 virtual Destructors
17.3.1 Initialization Without Constructors17.4 Member and Base Initialization
17.3.2.1 Initialization by Constructors17.3.2 Initialization Using Constructors
17.3.3 Default Constructors
17.3.4.1 initializer_list Constructor Disambiguation17.3.4 Initializer-List Constructors
17.3.4.2 Use of initializer_lists
17.3.4.3 Direct and Copy Initialization
17.4.1 Member Initialization17.5 Copy and Move
17.4.1.1 Member Initialization and Assignment17.4.2 Base Initializers
17.4.3 Delegating Constructors
17.4.4 In-Class Initializers
17.4.5 static Member Initialization
17.5.1 Copy17.6 Generating Default Operations
17.5.1.1 Beware of Default Constructors17.5.2 Move
17.5.1.2 Copy of Bases
17.5.1.3 The Meaning of Copy
17.5.1.4 Slicing
17.6.1 Explicit Defaults17.7 Advice
17.6.2 Default Operations
17.6.3 Using Default Operations
17.6.3.1 Default Constructors17.6.4 deleted Functions
17.6.3.2 Maintaining Invariants
17.6.3.3 Resource Invariants
17.6.3.4 Partially Specified Invariants
18.1 Introduction19 Special Operators
18.2 Operator Functions
18.2.1 Binary and Unary Operators18.3 A Complex Number Type
18.2.2 Predefined Meanings for Operators
18.2.3 Operators and User-Defined Types
18.2.4 Passing Objects
18.2.5 Operators in Namespaces
18.3.1 Member and Nonmember Operators18.4 Type Conversion
18.3.2 Mixed-Mode Arithmetic
18.3.3.1 Conversions of Operands18.3.3 Conversions
18.3.4 Literals
18.3.5 Accessor Functions
18.3.6 Helper Functions
18.4.1 Conversion Operators18.5 Advice
18.4.2 explicit Conversion Operators
18.4.3 Ambiguities
19.1 Introduction20 Derived Classes
19.2 Special Operators
19.2.1 Subscripting19.3 A String Class
19.2.2 Function Call
19.2.3 Dereferencing
19.2.4 Increment and Decrement
19.2.5 Allocation and Deallocation
19.2.6 User-defined Literals
19.3.1 Essential Operations19.4 Friends
19.3.2 Access to Characters
19.3.3.1 Ancillary Functions19.3.3 Representation
19.3.4 Member Functions
19.3.5 Helper Functions
19.3.6 Using Our String
19.4.1 Finding Friends19.5 Advice
19.4.2 Friends and Members
20.1 Introduction21 Class Hierarchies
20.2 Derived Classes
20.2.1 Member Functions20.3 Class Hierarchies
20.2.2 Constructors and Destructors
20.3.1 Type Fields20.4 Abstract Classes
20.3.2 Virtual Functions
20.3.3 Explicit Qualification
20.3.4 Override Control
20.3.4.1 override20.3.5 using Base Members
20.3.4.2 final
20.3.5.1 Inheriting Constructors20.3.6 Return Type Relaxation
20.5 Access Control
20.5.1 protected Members20.6 Pointers to Members
20.5.1.1 Use of protected Members20.5.2 Access to Base Classes
20.5.2.1 Multiple Inheritance and Access Control20.5.3 using-Declarations and Access Control
20.6.1 Pointers to Function Members20.7 Advice
20.6.2 Pointers to Data Members
20.6.3 Base and Derived Members
21.1 Introduction22 Run-Time Type Information
21.2 Design of Class Hierarchies
21.2.1 Implementation Inheritance21.3 Multiple Inheritance
21.2.1.1 Critique21.2.2 Interface Inheritance
21.2.3 Alternative Implementations
21.2.3.1 Critique21.2.4 Localizing Object Creation
21.3.1 Multiple Interfaces21.4 Advice
21.3.2 Multiple Implementation Classes
21.3.3 Ambiguity Resolution
21.3.4 Repeated Use of a Base Class
21.3.5 Virtual Base Classes
21.3.5.1 Constructing Virtual Bases21.3.6 Replicated vs. Virtual Bases
21.3.5.2 Calling a Virtual Class Member Once Only
21.3.6.1 Overriding Virtual Base Functions
22.1 Introduction23 Templates
22.2 Class Hierarchy Navigation
22.2.1 dynamic_cast22.3 Double Dispatch and Visitors
22.2.1.1 dynamic_cast to Reference22.2.2 Multiple Inheritance
22.2.3 dynamic_cast
22.2.4 Recovering an Interface
22.3.1 Double Dispatch22.4 Construction and Destruction
22.3.2 Visitors
22.5 Type Identification
22.5.1 Extended Type Information22.6 Uses and Misuses of RTTI
22.7 Advice
23.1 Introduction and Overview24 Generic Programming
23.2 A Simple String Template
23.2.1 Defining a Template23.3 Type Checking
23.2.2 Template Instantiation
23.3.1 Type Equivalence23.4 Class Template Members
23.3.2 Error Detection
23.4.1 Data Members23.5 Function Templates
23.4.2 Member Functions
23.4.3 Member Type Aliases
23.4.4 static Members
23.4.5 Member Types
23.4.6 Member Templates
23.4.6.1 Templates and Constructors23.4.7 Friends
23.4.6.2 Templates and virtual
23.4.6.3 Use of Nesting
23.5.1 Function Template Arguments23.6 Template Aliases
23.5.2 Function Template Argument Deduction
23.5.2.1 Reference Deduction23.5.3 Function Template Overloading
23.5.3.1 Ambiguity Resolution
23.5.3.2 Argument Substitution Failure
23.5.3.3 Overloading and Derivation
23.5.3.4 Overloading and Non-Deduced Parameters
23.7 Source Code Organization
23.7.1 Linkage23.8 Advice
24.1 Introduction25 Specialization
24.2 Algorithms and Lifting
24.3 Concepts
24.3.1 Discovering a Concept24.4 Making Concepts Concrete
24.3.2 Concepts and Constraints
24.4.1 Axioms24.5 Advice
24.4.2 Multi-argument Concepts
24.4.3 Value Concepts
24.4.4 Constraints Checks
24.4.5 Template Definition Checking
25.1 Introduction26 Instantiation
25.2 Template Parameters and Arguments
25.2.1 Types as Arguments25.3 Specialization
25.2.2 Values as Arguments
25.2.3 Operations as Arguments
25.2.4 Templates as Arguments
25.2.5 Default Template Arguments
25.2.5.1 Default Function Template Arguments
25.3.1 Interface Specialization25.4 Advice
25.3.1.1 Implementation Specialization25.3.2 The Primary Template
25.3.3 Order of Specialization
25.3.4.1 Specialization and Overloading25.3.4 Function Template Specialization
25.3.4.2 Specialization That Is Not Overloading
26.1 Introduction27 Templates and Hierarchies
26.2 Template Instantiation
26.2.1 When Is Instantiation Needed?26.3 Name Binding
26.2.2 Manual Control of Instantiation
26.3.1 Dependent Names26.4 Advice
26.3.2 Point-of-Definition Binding
26.3.3 Point-of-Instantiation Binding
26.3.4 Multiple Instantiation Points
26.3.5 Templates and Namespaces
26.3.6 Overaggressive ADL
26.3.7 Names from Base Classes
27.1 Introduction28 Metaprogramming
27.2 Parameterization and Hierarchy
27.2.1 Generated Types27.3 Hierarchies of Class Templates
27.2.2 Template Conversions
27.3.1 Templates as Interfaces27.4 Template Parameters as Base Classes
27.4.1 Composing Data Structures27.5 Advice
27.4.2 Linearizing Class Hierarchies
28.1 Introduction29 A Matrix Design
28.2 Type Functions
28.2.1 Type Aliases28.3 Control Structures
28.2.1.1 When Not to Use an Alias28.2.2 Type Predicates
28.2.3 Selecting a Function
28.2.4 Traits
28.3.1 Selection28.4 Conditional Definition: Enable_if
28.3.1.1 Selecting between Two Types28.3.2 Iteration and Recursion
28.3.1.2 Compile Time vs. Run Time
28.3.1.3 Selecting among Several Types
28.3.2.1 Recursion Using Classes28.3.3 When to Use Metaprogramming
28.4.1 Use of Enable_if28.5 A Compile-Time List: Tuple
28.4.2 Implementing Enable_if
28.4.3 Enable_if and Concepts
28.4.4 More Enable_if Examples
28.5.1 A Simple Output Function28.6 Variadic Templates
28.5.2.1 const Tuples28.5.2 Element Access
28.5.3 make_tuple
28.6.1 A Type-Safe printf()28.7 SI Units Example
28.6.2 Technical Details
28.6.3 Forwarding
28.6.4 The Standard-Library tuple
28.7.1 Units28.8 Advice
28.7.2 Quantitys
28.7.3 Unit Literals
28.7.4 Utility Functions
29.1 Introduction
29.1.1 Basic Matrix Uses29.2 A Matrix Template
29.1.2 Matrix Requirements
29.2.1 Construction and Assignment29.3 Matrix Arithmetic Operations
29.2.2 Subscripting and Slicing
29.3.1 Scalar Operations29.4 Matrix Implementation
29.3.2 Addition
29.3.3 Multiplication
29.4.1 slice()29.5 Solving Linear Equations
29.4.2 Matrix Slices
29.4.3 Matrix_ref
29.4.4 Matrix List Initialization
29.4.5 Matrix Access
29.4.6 Zero-Dimensional Matrix
29.5.1 Classical Gaussian Elimination29.6 Advice
29.5.2 Pivoting
29.5.3 Testing
29.5.4 Fused Operations
30 Standard-Library Overview
30.1 Introduction31 STL Containers
30.1.1 Standard-Library Facilities30.2 Headers
30.1.2 Design Constraints
30.1.3 Description Style
30.3 Language Support
30.3.1 initializer_list Support30.4 Error Handling
30.3.2 Range-for Support
30.4.1 Exceptions30.5 Advice
30.4.1.1 The Standard exception Hierarchy30.4.2 Assertions
30.4.1.2 Exception Propagation
30.4.1.3 terminate()
30.4.3.1 Error Codes30.4.3 system_error
30.4.3.2 Error Categories
30.4.3.3 Exception system_error
30.4.3.4 Potentially Portable Error Conditions
30.4.3.5 Mapping Error Codes
30.4.3.6 errc Error Codes
30.4.3.7 future_errc Error Codes
30.4.3.8 io_errc Error Codes
31.1 Introduction32 STL Algorithms
31.2 Container Overview
31.2.1 Container Representation31.3 Operations Overview
31.2.2 Element Requirements
31.2.2.1 Comparisons
31.2.2.2 Other Relational Operators
31.3.1 Member Types31.4 Containers
31.3.2 Constructors, Destructor, and Assignments
31.3.3 Size and Capacity
31.3.4 Iterators
31.3.5 Element Access
31.3.6 Stack Operations
31.3.7 List Operations
31.3.8 Other Operations
31.4.1 vector31.5 Container Adaptors
31.4.1.1 vector and Growth31.4.2 Lists
31.4.1.2 vector and Nesting
31.4.1.3 vector and Arrays
31.4.1.4 string
31.4.3.1 Ordered Associative Containers31.4.3 Associative Containers
31.4.3.2 Unordered Associative Containers
31.4.3.3 Constructing unordered_maps
31.4.3.4 Hash and Equality Functions
31.4.3.5 Load and Buckets
31.5.1 stack31.6 Advice
31.5.2 queue
31.5.3 priority_queue
32.1 Introduction33 STL Iterators
32.2 Algorithms
32.2.1 Sequences32.3 Policy Arguments
32.3.1 Complexity32.4 Nonmodifying Sequence Algorithms
32.4.1 for_each()32.5 Modifying Sequence Algorithms
32.4.2 Sequence Predicates
32.4.3 count()
32.4.4 find()
32.4.5 mismatch()
32.4.6 search()
32.5.1 copy()32.6 Sorting and Searching
32.5.2 unique()
32.5.3 replace()
32.5.4 partition()
32.5.5 Permutations
32.5.6 fill()
32.5.7 swap()
32.6.1 Binary Search32.7 Min and Max
32.6.2 merge()
32.6.3 Set Algorithms
32.6.4 Heaps
32.6.5 lexicographical_compare()
32.8 Advice
33.1 Introduction34 Memory and Resources
33.1.1 Iterator Model33.2 Iterator Adaptors
33.1.2 Iterator Categories
33.1.3 Iterator Traits
33.1.4 Iterator Operations
33.2.1 Reverse Iterator33.3 Range Access Functions
33.2.2 Insert Iterators
33.2.3 Move Iterator
33.4 Function Objects
33.5 Function Adaptors
33.5.1 bind()33.6 Advice
33.5.2 mem_fn()
33.5.3 function
34.1 Introduction35 Utilities
34.2 ``Almost Containers''
34.2.1 array34.3 Resource Management Pointers
34.2.2 bitset
34.2.2.1 Constructors34.2.3 vector
34.2.2.2 bitset Operations
34.2.4 Tuples
34.2.4.1 pair
34.2.4.2 tuple
34.3.1 unique_ptr34.4 Allocators
34.3.2 shared_ptr
34.3.3 weak_ptr
34.4.1 The Default Allocator34.5 The Garbage Collection Interface
34.4.2 Allocator Traits
34.4.3 Pointer Traits
34.4.4 Scoped Allocators
34.6 Uninitialized Memory
34.6.1 Temporary Buffers34.7 Advice
34.6.2 raw_storage_iterator
35.1 Introduction36 Strings
35.2 Time
35.2.1 duration35.3 Compile-Time Rational Arithmetic
35.2.2 time_point
35.2.3 Clocks
35.2.4 Time Traits
35.4 Type Functions
35.4.1 Type Traits35.5 Minor Utilities
35.4.2 Type Generators
35.5.1 forward()35.6 Advice
35.5.2 swap()
35.5.3 Relational Operators
35.5.4 Comparing and Hashing type_info
36.1 Introduction37 Regular Expressions
36.2 Character Classification
36.2.1 Classification Functions36.3 Strings
36.2.2 Character Traits
36.3.1 string vs. C-Style Strings36.4 Advice
36.3.2 Constructors
36.3.3 Fundamental Operations
36.3.4 String I/O
36.3.5 Numeric Conversions
36.3.6 STL-like Operations
36.3.7 The find Family
36.3.8 Substrings
37.1 Regular Expressions38 I/O Streams
37.1.1 Regular Expression Notation37.2 regex
37.2.1 Match Results37.3 Regular Expression Functions
37.2.2 Formatting
37.3.1 regex_match()37.4 Regular Expression Iterators
37.3.2 regex_search()
37.3.3 regex_replace()
37.4.1 regex_iterator37.5 regex_traits
37.4.2 regex_token_iterator
37.6 Advice
38.1 Introduction39 Locales
38.2 The I/O Stream Hierarchy
38.2.1 File Streams38.3 Error Handling
38.2.2 String Streams
38.4 I/O Operations
38.4.1 Input Operations38.5 Stream Iterators
38.4.1.1 Formatted Input38.4.2 Output Operations
38.4.1.2 Unformatted Input
38.4.2.1 Virtual Output Functions38.4.3 Manipulators
38.4.4 Stream State
38.4.5 Formatting
38.4.5.1 Formatting State
38.4.5.2 Standard Manipulators
38.4.5.3 User-Defined Manipulators
38.6 Buffering
38.6.1 Output Streams and Buffers38.7 Advice
38.6.2 Input Streams and Buffers
38.6.3 Buffer Iterators
38.6.3.1 istreambuf_iterator
38.6.3.2 ostreambuf_iterator
39.1 Handling Cultural Differences40 Numerics
39.2 Class locale
39.2.1 Named locales39.3 Class facet
39.2.1.1 Constructing New locales39.2.2 Comparing strings
39.3.1 Accessing locale39.4 Standard facets
39.3.2 A Simple User-Defined facet
39.3.3 Uses of facets
39.4.1 string Comparison39.5 Convenience Interfaces
39.4.1.1 Named collate39.4.2 Numeric Formatting
39.4.2.1 Numeric Punctuation39.4.3 Money Formatting
39.4.2.2 Numeric Output
39.4.2.3 Numeric Input
39.4.3.1 Money Punctuation39.4.4 Date and Time Formatting
39.4.3.2 Money Output
39.4.3.3 Money Input
39.4.4.1 time_put39.4.5 Character Classification
39.4.4.2 time_get
39.4.6 Character Code Conversion
39.4.7 Messages
39.4.7.1 Using Messages from Other facets
39.5.1 Character Classification39.6 Advice
39.5.2 Character Conversions
39.5.3 String Conversions
39.5.4 Buffer Conversions
40.1 Introduction41 Concurrency
40.2 Numerical Limits
40.2.1 Limit Macros40.3 Standard Mathematical Functions
40.4 complex Numbers
40.5 A Numerical Array: valarray
40.5.1 Constructors and Assignments40.6 Generalized Numerical Algorithms
40.5.2 Subscripting
40.5.3 Operations
40.5.4 Slices
40.5.5 slice_array
40.5.6 Generalized Slices
40.6.1 accumulate()40.7 Random Numbers
40.6.2 inner_product()
40.6.3 adjacent_difference()
40.6.4 iota()
40.7.1 Engines40.8 Advice
40.7.2 Random Device
40.7.3 Distributions
40.7.4 C-Style Random Numbers
41.1 Introduction42 Threads and Tasks
41.2 Memory Model
41.2.1 Memory Location41.3 Atomics
41.2.2 Instruction Reordering
41.2.3 Memory Order
41.2.4 Data Races
41.3.1 atomic Types41.4 volatile
41.3.2.1 atomic Flags41.3.2 Flags and Fences
41.3.2.2 Fences
41.5 Advice
42.1 Introduction43 The C Standard Library
42.2 Threads
42.2.1 Identity42.3 Avoiding Data Races
42.2.2 Construction
42.2.3 Destruction
42.2.4 join()
42.2.5 detach()
42.2.6 Namespace this_thread
42.2.7 Killing a thread
42.2.8 thread_local Data
42.3.1 Mutexes42.4 Task-Based Concurrency
42.3.1.1 recursive_mutex42.3.2 Multiple Locks
42.3.1.2 mutex Errors
42.3.1.3 recursive_timed_mutex
42.3.1.4 unique_lock
42.3.3 call_once()
42.3.4 Condition Variables
42.3.4.1 condition_variable_any
42.4.1 promise42.5 Advice
42.4.2 promise
42.4.3 packaged_task
42.4.4 future
42.4.5 shared_future
42.4.6 async()
42.4.7 A Parallel find() Example
43.1 Introduction44 Compatibility
43.2 Files
43.3 The printf() Family
43.4 C-Style Strings
43.5 Memory
43.6 Date and Time
43.7 Etc.
43.8 Advice
44.1 Introduction
44.2.1 Language Features44.2 C++11 Extensions
44.2.2 Standard_Library Components
44.2.3 Deprecated Features
44.2.4 Coping with Older C++ Implementations
44.3 C/C++ Compatibility
44.3.1 C and C++ Are Siblings44.4 Advice
44.3.2 ``Silent'' Differences
44.3.3 C Code That Is Not C++
44.3.3.1 ``Classic C'' Problems44.3.4 C++ Code That Is Not C
44.3.3.2 C Features Not Adopted by C++
I Index