The C++ Standard Library
Minimum price
Suggested price

The C++ Standard Library

What every professional C++ programmer should know about the C++ standard library.

About the Book

The C++ Standard Library is a reference to the C++ standard library based on C++20.

The Goal

The goal of The C++ Standard Library is to provide you a concise reference of the C++ standard library in about 300 pages. his book assumes that you are familiar with C++. If so, you will get the most benefit from this book. If C++ is new to you, you should start with a textbook about core C++. Once you have mastered a textbook about the core language, you can make your next big step by reading my book.

This book has, also, more than 100 running code examples to the code snippets I presented in the book. Therefore you can combine the theory with the practices and get the most of it.

Many Thanks

In particular, I thank the English proofreaders of my book: Mahesh Attarde, Rick Audet, Pete Barrow, Michael Ben-David, Dave Burns, Juliette Grimm, Marius Grimm, Alvaro Fernandez, George Haake, Clare Macrae, Arne Mertz, Ian Reeve, Jason Turner, Bart Vandewoestyne, Ivan Vergiliev, and Andrzej Warzynski. They translated my Swabian English into English. Without their work, the book wouldn't have been possible.

About the Author

Rainer Grimm
Rainer Grimm

Rainer Grimm


The Book


  • extras
    Source code

    All source files to the code examples in the book. You find the name of the source file in the first line of the code example.

  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price
The C++ Standard Library Team Edition: Five Copies

Get five copies to the price of three. This package includes all code examples.


  • extras
    Source code

    All source files to the code examples in the book. You find the name of the source file in the first line of the code example.

  • PDF

  • EPUB

  • WEB

  • English

Minimum price
Suggested price

Bundles that include this book

Bought separately
Bundle Price
Bought separately
Bundle Price

Reader Testimonials

Rick Audet
Rick Audet

Senior Engineer, Dolby Laboratories

Arguably the quickest and easiest way to get up to speed on the most important parts of the C++ standard library. Recommended for any modern C++ programmer.

Zeshuang Mi
Zeshuang Mi


The C++ Standard Library makes me so clear about the content of the STL, which make me dive into most important parts of the C++ Library. Such as Containers, the usage of the Iterators with Containers, the type of Callable Units, the lookup of Algorithm and so all, Sincerely, all C++ Programmers should treat this book as a reference book. You will benefit a lot. Trust me! At last, I wanna thank the author, thanking his book improves my insight.

Quan Zhuo
Quan Zhuo

Software engineer at Foxconn

The book introduced the new standard library features from C++11 to C++20. With a large number of examples to deepen your understanding. Suitable for C++ enthusiasts to print it and put on the bedside, desk. Concise and comprehensive. Every time I read it, I get someing new.

Table of Contents

  • Reader Testimonials
    • English Edition
    • German Edition
  • Introduction
    • About Me
    • Purpose of this Book
    • Index
    • Conventions
    • Source Examples
    • Source Code
    • Value versus Object
    • Acknowledgements
    • Further Information
    • C++ versus C++11
  • 1. The Standard Library
    • The History
    • Overview
    • Application of Libraries
  • 2. Utilities
    • Useful Functions
    • Save Comparison of Integers
    • Adaptors for Functions
    • Pairs
    • Tuples
    • Reference Wrappers
    • Smart Pointers
    • Type Traits
    • Time Library
    • std::any, std::optional, and std::variant
  • 3. Interface of All Containers
    • Create and delete
    • Size
    • Access
    • Assign and Swap
    • Compare
    • Erasure
  • 4. Sequence Containers
    • Arrays
    • Vectors
    • Deques
    • Lists
    • Forward Lists
  • 5. Associative Containers
    • Overview
    • Ordered Associative Containers
    • Unordered Associative Containers
  • 6. Adaptors for Containers
    • Stack
    • Queue
    • Priority Queue
  • 7. Views on Contiguous Sequences
  • 8. Iterators
    • Categories
    • Iterator Creation
    • Useful Functions
    • Adaptors
  • 9. Callable Units
    • Functions
    • Function Objects
    • Lambda Functions
  • 10. Algorithms
    • Conventions
    • Iterators are the Glue
    • Sequential, Parallel, or Parallel Execution with Vectorisation
    • for_each
    • Non-Modifying Algorithms
    • Modifying Algorithms
    • Partition
    • Sort
    • Binary Search
    • Merge Operations
    • Heaps
    • Min and Max
    • Permutations
    • Numeric
  • 11. Ranges
    • Range
    • View
    • Direct on the Containers
    • Function Composition
    • Lazy Evaluation
  • 12. Numeric
    • Random Numbers
    • Numeric Functions Inherited from C
    • Mathematical Constants
  • 13. Strings
    • Create and Delete
    • Conversion Between C++ and C Strings
    • Size versus Capacity
    • Comparison
    • String Concatenation
    • Element Access
    • Input and Output
    • Search
    • Check for a Prefix or a Suffix
    • Modifying Operations
    • Numeric Conversions
  • 14. String Views
    • Create and Initialise
    • Non-modifying operations
    • Modifying operations
  • 15. Regular Expressions
    • Character Types
    • Regular Expression Objects
    • The Search Result match_results
    • Match
    • Search
    • Replace
    • Format
    • Repeated Search
  • 16. Input and Output Streams
    • Hierarchy
    • Input and Output Functions
    • Streams
    • User-defined Data Types
  • 17. Formatting Library
    • Syntax
    • Format specification
    • User-defined formatter
  • 18. Filesystem
    • Classes
    • Non-member functions
    • File types
  • 19. Multithreading
    • Memory Model
    • Atomic Data Types
    • Threads
    • Stop Token
    • Shared Variables
    • Thread Local Data
    • Condition Variables
    • Semaphores
    • Coordination Types
    • Tasks
  • 20. Coroutines
    • Awaitables
    • An Infinite Data Stream with co_yield
  • Index

The Leanpub 60-day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Do Well. Do Good.

Authors have earned$12,156,430writing, publishing and selling on Leanpub, earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub