Nicht aus der Schweiz? Besuchen Sie lehmanns.de
C++17 Standard Library Quick Reference -  Marc Gregoire,  Peter Van Weert

C++17 Standard Library Quick Reference (eBook)

A Pocket Guide to Data Structures, Algorithms, and Functions
eBook Download: PDF
2019 | 2nd ed.
XXIII, 293 Seiten
Apress (Verlag)
978-1-4842-4923-9 (ISBN)
Systemvoraussetzungen
46,99 inkl. MwSt
(CHF 45,90)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen
This quick reference is a condensed guide to the essential data structures, algorithms, and functions provided by the C++17 Standard Library. It does not explain the C++ language or syntax, but is accessible to anyone with basic C++ knowledge or programming experience. Even the most experienced C++ programmer will learn a thing or two from it and find it a useful memory-aid. 

It is hard to remember all the possibilities, details, and intricacies of the vast and growing Standard Library. This handy reference guide is therefore indispensable to any C++ programmer. It offers a condensed, well-structured summary of all essential aspects of the C++ Standard Library. No page-long, repetitive examples or obscure, rarely used features. Instead, everything you need to know and watch out for in practice is outlined in a compact, to-the-point style, interspersed with practical tips and well-chosen, clarifying examples. 

This new edition is updated to include all Standard Library changes in C++17, including the new vocabulary types std::string_view, any, optional, and variant; parallel algorithms; the file system library; specialized mathematical functions; and more.

What You Will Learn
  • Gain the essentials that the C++ Standard Library has to offer
  • Use containers to efficiently store and retrieve your data
  • Inspect and manipulate your data with algorithms 
  • See how lambda expressions allow for elegant use of algorithms
  • Discover what the standard string class provides and how to use it
  • Write localized applications
  • Work with file and stream-based I/O
  • Prevent memory leaks with smart pointers
  • Write safe and efficient multi-threaded code using the threading libraries

Who This Book Is For

All C++ programmers, irrespective of their proficiency with the language or the Standard Library. A secondary audience is developers who are new to C++, but not new to programming, and who want to learn more about the C++ Standard Library in a quick, condensed manner.



Marc Gregoire is a software engineer from Belgium. He graduated from the University of Leuven, Belgium, with a degree in 'Burgerlijk ingenieur in de computer wetenschappen' (equivalent to Master of Science in engineering in computer science). The year after, he received the cum laude degree of master in artificial intelligence at the same university. After his studies, Marc started working for a software consultancy company called Ordina Belgium. As a consultant, he worked for Siemens and Nokia Siemens Networks on critical 2G and 3G software running on Solaris for telecom operators. This required working in international teams stretching from South America and USA to EMEA and Asia. Now, Marc is working for Nikon Metrology on industrial 3D laser scanning software. His main expertise is C/C++, and specifically Microsoft VC++ and the MFC framework. He has experience in developing C++ programs running 24x7 on Windows and Linux platforms; for example, KNX/EIB home automation software. Next to C/C++, Marc also likes C# and uses PHP for creating web pages. Since April 2007, he received the yearly Microsoft MVP (Most Valuable Professional) award for his Visual C++ expertise. Marc is the founder of the Belgian C++ Users Group, author of Professional C++ and a member on the CodeGuru forum (as Marc G). 

Peter Van Weert is a Belgian software engineer, whose main interests and expertise are programming languages, algorithms, and data structures. He received his master of science in computer science summa cum laude with congratulations of the Board of Examiners from the University of Leuven. In 2010, he completed his PhD thesis on the design and efficient compilation of rule based programming languages at the declarative programming languages and artificial intelligence department of the same university. During his doctoral studies, he was a teaching assistant for object-oriented programming (Java), software analysis and design, and declarative programming. After graduating, Peter joined Nikon Metrology to work on large-scale, industrial application software in the area of 3D laser scanning and point cloud inspection. At Nikon, he has mastered C++, refactoring and debugging very large code bases, and has gained further proficiency in all aspects of the software development process, including the analysis of functional and technical requirements, and agile and scrum-based project and team management. In his spare time, he has co-authored two award-winning Windows 8 apps, and is a regular speaker at and board member of the Belgian C++ Users Group.


This quick reference is a condensed guide to the essential data structures, algorithms, and functions provided by the C++17 Standard Library. It does not explain the C++ language or syntax, but is accessible to anyone with basic C++ knowledge or programming experience. Even the most experienced C++ programmer will learn a thing or two from it and find it a useful memory-aid. It is hard to remember all the possibilities, details, and intricacies of the vast and growing Standard Library. This handy reference guide is therefore indispensable to any C++ programmer. It offers a condensed, well-structured summary of all essential aspects of the C++ Standard Library. No page-long, repetitive examples or obscure, rarely used features. Instead, everything you need to know and watch out for in practice is outlined in a compact, to-the-point style, interspersed with practical tips and well-chosen, clarifying examples. This new edition is updated to include all Standard Library changes in C++17, including the new vocabulary types std::string_view, any, optional, and variant; parallel algorithms; the file system library; specialized mathematical functions; and more.What You Will LearnGain the essentials that the C++ Standard Library has to offerUse containers to efficiently store and retrieve your dataInspect and manipulate your data with algorithms See how lambda expressions allow for elegant use of algorithmsDiscover what the standard string class provides and how to use itWrite localized applicationsWork with file and stream-based I/OPrevent memory leaks with smart pointersWrite safe and efficient multi-threaded code using the threading librariesWho This Book Is ForAll C++ programmers, irrespective of their proficiency with the language or the Standard Library. A secondary audience is developers who are new to C++, but not new to programming, and who want to learn more about the C++ Standard Library in a quick, condensed manner.

Contents 5
About the Authors 15
About the Technical Reviewer 17
Introduction 18
Chapter 1: Numerics and Math 23
Common Mathematical Functions< cmath>
Basic Functions 23
Exponential and Logarithmic Functions 24
Power Functions 24
Trigonometric and Hyperbolic Functions 25
Integral Rounding of Floating-Point Numbers 25
Floating-Point Manipulation Functions 25
Classification and Comparison Functions 26
gcd/lcm< numeric>
Error Handling 27
Special Mathematical Functions< cmath>
Bessel Functions 28
Polynomials 29
Elliptic Integrals 29
Exponential Integrals 30
Error Functions 30
Gamma Functions 30
Beta Functions 31
Zeta Functions 31
Minimum, Maximum, and Clamping< algorithm>
Fixed-Width Integer Types< cstdint>
Arithmetic Type Properties< limits>
Complex Numbers< complex>
Compile-Time Rational Numbers< ratio>
Random Numbers< random>
Random Number Generators 37
Pseudorandom Number Engines 38
Engine Adaptors 38
Predefined Engines 39
Nondeterministic Random Number Generator 40
Seeding 40
Random Number Distributions 40
Uniform Distributions 41
Bernoulli Distributions 41
Normal Distributions 41
Poisson Distributions 42
Sampling Distributions 42
Discrete Distribution 42
Piecewise Constant Distribution 43
Piecewise Linear Distribution 44
Example 44
Numeric Arrays< valarray>
std::slice 46
std::gslice 47
std::mask_array 48
std::indirect_array 49
Chapter 2: General Utilities 50
Moving, Forwarding, Swapping< utility>
Moving 50
Forwarding 52
Swapping and Exchanging 53
Pairs and Tuples 54
Pairs< utility>
Tuples< tuple>
std::byte< cstddef>
Relational Operators< utility>
Smart Pointers< memory>
Exclusive Ownership Pointers 57
std::unique_ptr 57
std::auto_ptr 60
Shared Ownership Pointers 60
std::shared_ptr 60
std::weak_ptr 62
std::enable_shared_from_this 62
Function Objects< functional>
Reference Wrappers 64
Predefined Functors 64
Binding Function Arguments 65
Negating a Callable 66
Generic Function Wrappers 66
Functors for Class Members 67
Initializer Lists< initializer_list>
Vocabulary Types 69
std::optional< optional>
std::nullopt_t 69
Constructors 70
Methods and Non-member Functions 71
std::variant< variant>
Construction 72
Default Construction 72
Constructors 72
Methods and Non-member Functions 73
Example Usage 74
Visitation 74
Helper Classes 75
std::any< any>
Constructors 76
Methods and Non-member Functions 76
Example Usage 77
Date and Time Utilities< chrono>
Durations 78
Time Points 79
Clocks 80
C-Style Date and Time Utilities< ctime>
Type Utilities 83
Runtime Type Identification< typeinfo>
Type Traits< type_traits>
Helper Classes 84
Type Classification 85
Type Properties 86
Type Relationships 87
Type Property Queries 87
Type Transformations 88
SFINAE Templates 89
std::enable_if 89
std::void_t 90
Function Invocation Traits 90
Trait Operations 91
Type Operations< utility>
std::declval 91
std::as_const 92
Generic Utilities 92
std::invoke< functional>
std::addressof< memory>
Chapter 3: Containers 94
Iterators< iterator>
Iterator Tags 95
Non-member Functions to Get Iterators 96
Non-member Operations on Iterators 97
Sequential Containers 97
std::vector< vector>
Construction 98
Accessing Elements 98
Iterators 99
Adding Elements 99
Size and Capacity 101
Removing Elements 101
Remove-Erase Idiom 102
std::vector< bool>
Complexity 103
std::deque< deque>
Complexity 104
std::array< array>
Complexity 105
std::list and std::forward_list< list>
Complexity 106
List-Specific Algorithms 106
Sequential Containers Reference 107
Iterators 107
Size and Capacity 108
Access 108
Modifiers 109
Non-member Functions 110
std::bitset< bitset>
Complexity 111
Reference 111
Access 111
Operations 111
Container Adaptors 112
std::queue< queue>
std::priority_queue< queue>
std::stack< stack>
Example 113
Reference 114
Ordered Associative Containers 114
std::map< map>
Inserting in a Map 116
The Square Brackets Operator 116
insert() and insert_or_assign() 116
emplace() and try_emplace() 117
Hints 118
Return Values 118
std::multimap< map>
std::set and std::multiset< set>
Order of Elements 119
Searching 120
Moving Nodes Between Containers 121
Merging Containers 121
Complexity 122
Reference 122
Iterators 122
Size 122
Access and Lookup 123
Modifiers 123
Observers 124
Non-member Functions 124
Unordered Associative Containers < unordered_map>
Hash Map 125
Template Type Parameters 125
Hash Functions 125
Complexity 127
Reference 127
Observers 127
Bucket Interface 128
Hash Policy 128
Non-member Functions 128
Allocators< memory>
Polymorphic Allocators< memory_resource>
Type Aliases 130
Monotonic Buffers 130
Memory Pools 131
Allocators for Multilevel Containers< scoped_allocator>
Chapter 4: Algorithms 133
Input and Output Iterators 133
General Guidelines 134
Algorithm Arguments 134
Terminology 135
Algorithms< algorithm>
Applying a Function to a Range 135
Example 136
Checking for the Presence of Elements 137
Example 137
Finding Elements 137
Example 138
Finding Min/Max Elements 138
Binary Search 139
Example 139
Subsequence Search 140
Example 141
Sequence Comparison 141
Generating Sequences 142
Example 143
Copy, Move, Swap 143
Example 144
Removing and Replacing 144
Example 145
Reversing and Rotating 145
Example 146
Partitioning 146
Sorting 147
Example 148
Sampling and Shuffling 148
Example 149
Operations on Sorted Ranges 149
Permutation 150
Heaps 151
Numeric Algorithms< numeric>
Reductions 152
Example 153
Inner Products 153
Example 153
Prefix Sums 154
Element Differences 155
Algorithms for Uninitialized Memory< memory>
Parallel Algorithms< execution>
Parallel Execution 157
Parallel Unsequenced Execution 158
Iterator Adaptors< iterator>
Chapter 5: Input/Output 160
Input/Output with Streams 160
Helper Types< ios>
Formatting Methods (std::ios_base)< ios>
I/O Manipulators< ios>
Example 165
std::ios< ios>
Stream State 166
Error Handling 167
Other Methods 168
std::ostream< ostream>
I/O Manipulators 169
Global Output Streams< iostream>
Example 170
std::istream< istream>
I/O Manipulators 171
Global Input Streams< iostream>
Example 172
std::iostream< istream>
String Streams< sstream>
Example 173
File Streams< fstream>
Example 175
Streaming Custom Types 175
Custom < <
Custom I/O Manipulators< ios>
Example 178
Stream Iterators< iterator>
std::ostream_iterator 179
std::istream_iterator 179
Stream Buffers< streambuf>
File Systems< filesystem>
Files, Paths, and Pathnames 181
Error Reporting 182
The path Class 183
Construction and Assignment 183
Conversion to Strings 184
Decomposition 184
Composition 186
Modification 187
File Links 187
Path Normalization 188
The Current Working Directory 189
Absolute and Relative Paths 189
Comparing Paths 191
File Status 191
File Types 192
File Permissions 193
Creating, Copying, Deleting, and Renaming 195
File Sizes and Free Space 196
Directory Listing 197
C-Style File Utilities< cstdio>
C-Style Output and Input< cstdio>
std::printf() Family 200
Example 204
std::scanf() Family 204
Example 206
Chapter 6: Characters and Strings 207
Strings< string>
Searching in Strings 208
Modifying Strings 209
Constructing Strings 210
String Length 210
Copying (Sub)Strings 211
Comparing Strings 211
String Views< string_view>
Character Classification< cctype>
Character-Encoding Conversion< locale>
Localization< locale>
Locale Names 218
The Global Locale 219
Basic std::locale Members 220
Locale Facets 220
Numeric Formatting 221
Numeric Punctuation 221
Formatting and Parsing of Numeric Values 222
Monetary Formatting 222
Monetary Punctuation 222
Formatting and Parsing of Monetary Values 223
Time and Date Formatting 224
Character Classification, Transformation, and Conversion 225
Character Classification and Transformation 225
Character-Encoding Conversions 226
String Ordering and Hashing 226
Message Retrieval 227
Combining and Customizing Locales 228
Combining Facets 228
Custom Facets 229
C Locales< clocale>
Regular Expressions< regex>
The ECMAScript Regular Expression Grammar 232
Character Classes 233
Greedy vs. Non-greedy Quantification 234
Regular Expression Objects 234
Construction and Syntax Options 234
Basic Member Functions 235
Matching and Searching Patterns 236
Match Results 237
std::sub_match 237
std::match_results 238
Example 239
Match Iterators 239
Tokenizing 240
Replacing Patterns 241
Numeric Conversions 244
Convenient Conversion Functions< string>
Parsing Integers 245
Parsing Floating-Point Numbers 246
Error Reporting and Number Formatting 246
High-Performance Conversion Functions< charconv>
Chapter 7: Concurrency 249
Threads< thread>
Launching a New Thread 249
A Thread’s Lifetime 250
Thread Identifiers 250
Utility Functions 251
Exceptions 251
Futures< future>
Return Objects 252
Providers 253
Async 253
Packaged Tasks 254
Promises 255
Exceptions 255
Mutual Exclusion< mutex>
Mutexes and Locks 256
Example 257
Mutex Types 257
Common Functionality 258
Recursion 258
Timeouts 258
Sharing Ownership< shared_mutex>
Lock Types 259
std::scoped_lock 259
std::unique_lock 260
std::shared_lock< shared_mutex>
Locking Multiple Mutexes 262
Exceptions 262
Calling a Function Once< mutex>
Condition Variables< condition_variable>
Waiting for a Condition 264
Notification 265
Exceptions 266
L1 Data Cache Line Size< new>
Synchronization 267
Atomic Operations< atomic>
Atomic Variables 268
Template Specializations and Type Aliases 269
Basic Atomic Operations 269
Atomic Exchange of Values 270
Lock-Free Atomic Operations 271
Atomic Operations for Integral and Pointer Types 272
Synchronization 272
Atomic Flags 273
Non-member Functions and Macros 273
Fences 273
Chapter 8: Diagnostics 274
Assertions< cassert>
Exceptions< exception>
Exception Pointers< exception>
Nested Exceptions< exception>
System Errors< system_error>
std::error_category 280
std::error_code 280
std::error_condition 281
C Error Numbers< cerrno>
Failure Handling< exception>
std::uncaught_exceptions() 282
std::terminate() 283
Appendix: Standard Library Headers 287
Numerics and Math (Chapter 1) 287
General Utilities (Chapter 2) 288
Containers (Chapter 3) 289
Algorithms (Chapter 4) 290
Input/Output (Chapter 5) 290
Characters and Strings (Chapter 6) 291
Concurrency (Chapter 7) 292
Diagnostics (Chapter 8) 293
The C Standard Library 293
Index 294

Erscheint lt. Verlag 31.7.2019
Zusatzinfo XXIII, 293 p. 252 illus.
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Informatik Theorie / Studium Algorithmen
Informatik Theorie / Studium Compilerbau
Schlagworte C++ • C++ 17 • C++17 • Code • Cplusplus • programming • Quick • Reference • Standard Library • STL • Syntax • Templates
ISBN-10 1-4842-4923-2 / 1484249232
ISBN-13 978-1-4842-4923-9 / 9781484249239
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 7,9 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Build memory-efficient cross-platform applications using .NET Core

von Trevoir Williams

eBook Download (2024)
Packt Publishing (Verlag)
CHF 29,30
Learn asynchronous programming by building working examples of …

von Carl Fredrik Samson

eBook Download (2024)
Packt Publishing Limited (Verlag)
CHF 29,30