HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
The C++11 standard allows programmers to express ideas more clearly, simply, and directly, and to write faster, more efficient code. Bjarne Stroustrup, the designer and original implementer of C++, thoroughly covers the details of this language and its use in his definitive reference, The C++ Programming Language, Fourth Edition.
In A Tour of C++, Stroustrup excerpts the overview chapters from that complete reference, expanding and enhancing them to give an experienced programmer–in just a few hours–a clear idea of what constitutes modern C++. In this concise, self-contained guide, Stroustrup covers most major language features and the major standard-library components–not, of course, in great depth, but to a level that gives programmers a meaningful overview of the language, some key examples, and practical help in getting started.
Stroustrup presents the C++ features in the context of the programming styles they support, such as object-oriented and generic programming. His tour is remarkably comprehensive. Coverage begins with the basics, then ranges widely through more advanced topics, including many that are new in C++11, such as move semantics, uniform initialization, lambda expressions, improved containers, random numbers, and concurrency. The tour ends with a discussion of the design and evolution of C++ and the extensions added for C++11.
This guide does not aim to teach you how to program (see Stroustrup’s Programming: Principles and Practice Using C++ for that); nor will it be the only resource you’ll need for C++ mastery (see Stroustrup’s The C++ Programming Language, Fourth Edition, for that). If, however, you are a C or C++ programmer wanting greater familiarity with the current C++ language, or a programmer versed in another language wishing to gain an accurate picture of the nature and benefits of modern C++, you can’t find a shorter or simpler introduction than this tour provides.
Preface to Bjarne Stroustrup's "A Tour of C++"
Preface ix
Chapter 1: The Basics 1
1.1 Introduction 1
1.2 Programs 1
1.3 Hello, World! 2
1.4 Functions 3
1.5 Types, Variables, and Arithmetic 5
1.6 Scope 8
1.7 Constants 8
1.8 Pointers, Arrays, and References 9
1.9 Tests 12
1.10 Advice 14
Chapter 2: User-Defined Types 15
2.1 Introduction 15
2.2 Structures 16
2.3 Classes 17
2.4 Unions 19
2.5 Enumerations 20
2.6 Advice 21
Chapter 3: Modularity 23
3.1 Introduction 23
3.2 Separate Compilation 24
3.3 Namespaces 26
3.4 Error Handling 27
3.5 Advice 31
Chapter 4: Classes 33
4.1 Introduction 33
4.2 Concrete Types 34
4.3 Abstract Types 39
4.4 Virtual Functions 42
4.5 Class Hierarchies 42
4.6 Copy and Move 48
4.7 Advice 56
Chapter 5: Templates 59
5.1 Introduction 59
5.2 Parameterized Types 59
5.3 Function Templates 62
5.4 Concepts and Generic Programming 62
5.5 Function Objects 64
5.6 Variadic Templates 66
5.7 Aliases 67
5.8 Template Compilation Model 68
5.9 Advice 68
Chapter 6: Library Overview 71
6.1 Introduction 71
6.2 Standard-Library Components 72
6.3 Standard-Library Headers and Namespace 72
6.4 Advice 74
Chapter 7: Strings and Regular Expressions 75
7.1 Introduction 75
7.2 Strings 75
7.3 Regular Expressions 78
7.4 Advice 84
Chapter 8: I/O Streams 85
8.1 Introduction 85
8.2 Output 86
8.3 Input 87
8.4 I/O State 89
8.5 I/O of User-Defined Types 90
8.6 Formatting 91
8.7 File Streams 92
8.8 String Streams 92
8.9 Advice 93
Chapter 9: Containers 95
9.1 Introduction 95
9.2 vector 96
9.3 list 100
9.4 map 101
9.5 unordered_map 102
9.6 Container Overview 103
9.7 Advice 104
Chapter 10: Algorithms 107
10.1 Introduction 107
10.2 Use of Iterators 108
10.3 Iterator Types 111
10.4 Stream Iterators 112
10.5 Predicates 113
10.6 Algorithm Overview 114
10.7 Container Algorithms 115
10.8 Advice 115
Chapter 11: Utilities 117
11.1 Introduction 117
11.2 Resource Management 117
11.3 Specialized Containers 121
11.4 Time 125
11.5 Function Adaptors 125
11.6 Type Functions 128
11.7 Advice 131
Chapter 12: Numerics 133
12.1 Introduction 133
12.2 Mathematical Functions 134
12.3 Numerical Algorithms 135
12.4 Complex Numbers 135
12.5 Random Numbers 136
12.6 Vector Arithmetic 138
12.7 Numeric Limits 138
12.8 Advice 138
Chapter 13: Concurrency 141
13.1 Introduction 141
13.2 Tasks and threads 142
13.3 Passing Arguments 143
13.4 Returning Results 144
13.5 Sharing Data 144
13.6 Waiting for Events 146
13.7 Communicating Tasks 147
13.8 Advice 151
Chapter 14: History and Compatibility 153
14.1 History 153
14.2 C++11 Extensions 158
14.3 C/C++ Compatibility 161
14.4 Bibliography 166
14.5 Advice 168
Index 171