The C++ Standard Library
The C++ Standard Library is a collection of essential classes and functions used by millions of C++ programmers on a daily basis. Being part of the ISO Standard of the C++ Programming Language, an implementation is distributed with virtually every C++ compiler. Code written with the C++ Standard Library is therefore portable across compilers and target platforms.
The Library is more than 25 years old. Its initial versions were heavily inspired by a (then proprietary) C++ library called the Standard Template Library (STL) , so much so that many still incorrectly refer to the Standard Library as the STL. The STL library pioneered generic programming with templated data structures called containers and algorithms , glued together with the concept of iterators . Most of this work was adapted by the C++ standardization committee, but nevertheless neither library is a true superset of the other.
Today the C++ Standard Library is much more than the containers and algorithms of the STL, though. For decades, it has featured STL-like string classes, extensive localization facilities, and a stream-based I/O library, as well as the entire C Standard Library. Earlier this decade, the C++11 and C++14 editions of the ISO standard have added, among other things, hash map containers, generic smart pointers, a versatile random number generation framework, a powerful regular expression library, more expressive utilities for function-style programming, type traits for template metaprogramming, and a portable concurrency library featuring threads, mutexes, condition variables, and atomic variables. Most recently, C++17 has introduced, among many smaller additions, parallelized algorithms, a file system library, and several key types for day-to-day use (such as optional<> , variant<> , any , and string_view ). Many of the C++11, C++14, and C++17 additions are based on Boost, a collection of open source C++ libraries.
And this is just the beginning: the C++ community has rarely been as active and alive as in the past decade. The next version of the Standard, tentatively called C++20, is expected to add even more essential classes and functions.
Why This Book?
Needless to say, it is hard to know and remember all the possibilities, details, and intricacies of the vast and growing C++ Standard Library. This handy reference guide offers a condensed, well-structured summary of all essential aspects of the C++ Standard Library and is therefore indispensable to any C++ programmer.
You could consult the Standard itself, but it is written in a very detailed, technical style and is primarily targeted at Library implementors. Moreover, it is very long: the C++ Standard Library chapters alone are nearly 1,000 pages in length, and those on the C Standard Library easily encompass another 200 pages. Other reference guides exist but are often outdated, limited (most cover little more than the STL containers and algorithms), or not much shorter than the Standard itself.
This book covers all important aspects of the C++17 and C18 Standard Libraries, some in more detail than others, and is always driven by their practical usefulness. You will not find page-long, repetitive examples; obscure, rarely used features; or bloated, lengthy explanations that could be summarized in just a few bullets. Instead, this book strives to be exactly that: a summary. 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 short, well-chosen, clarifying examples.
Who Should Read This Book?
The book is targeted at all C++ programmers, regardless of their proficiency with the language or the Standard Library. If you are new to C++, its tutorial aspects will quickly bring you up to speed with the C++ Standard Library. Even the most experienced C++ programmer, however, will learn a thing or two from the book and find it an indispensable reference and memory aid. The book does not explain the C++ language or syntax itself, but is accessible to anyone with basic C++ knowledge or programming experience.
What You Will Learn
How to use the powerful random number generation facilities
How to work with dates and times
What smart pointers are and how to use them to prevent memory leaks
How to use containers to efficiently store and retrieve your data