C++ Standard Library Quick Reference

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

This quick reference is a condensed reference guide to the essential data structures, algorithms, and functions provided by the C++ Standard Library. Used by millions of C++ programmers on a daily basis, the C++ Standard Library features core classes for strings, I/O streams, and various generic containers, as well as a comprehensive set of algorithms to manipulate them. In recent years, the C++11 and C++14 standards have added even more efficient container classes, a new powerful regular expression library, and a portable multithreading library featuring threads, mutexes, condition variables, and atomic variables.
Needless to say, it is hard to know and remember all the possibilities, details, and intricacies of this vast and growing 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. The book 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 though will learn a thing or two from it and find it a useful memory-aid. Among the topics covered are:
The essentials that the C++ Standard Library has to offer
How to use containers to efficiently store and retrieve your data
How to use algorithms to inspect and manipulate your data
How lambda expressions allow for elegant use of algorithms
What the standard string class provides and how to use it
How to write localized applications
What functionality the library provides for file and stream-based I/O
What smart pointers are and how to use them to prevent memory leaks
How to write safe and efficient multi-threaded code using the C++11 threading libraries

Author(s): Peter Van Weert; Marc Gregoire
Publisher: Apress
Year: 2016

Language: English
Pages: 211

Contents at a Glance
Contents
About the Authors
About the Technical Reviewer
Introduction
Chapter 1: Numerics and Math
Common Mathematical Functions
Basic Functions
Exponential and Logarithmic Functions
Power Functions
Trigonometric and Hyperbolic Functions
Error and Gamma Functions
Integral Rounding of Floating-Point Numbers
Floating-Point Manipulation Functions
Classification and Comparison Functions
Error Handling
Fixed-Width Integer Types
Arithmetic Type Properties
Complex Numbers
Compile-Time Rational Numbers
Random Numbers
Random Number Generators
Pseudorandom Number Engines
Engine Adaptors
Predefined Engines
Non-Deterministic Random Number Generator
Seeding
Random Number Distributions
Uniform Distributions
Bernoulli Distributions
Normal Distributions
Poisson Distributions
Sampling Distributions
Discrete Distribution
Piecewise Constant Distribution
Piecewise Linear Distribution
Example
Numeric Arrays
std::slice
std::gslice
std::mask_array
std::indirect_array
Chapter 2: General Utilities
Moving, Forwarding, Swapping
Moving
Forwarding
Swapping
Pairs and Tuples
Pairs
Tuples
Relational Operators
Smart Pointers
Exclusive-Ownership Pointers
std::unique_ptr
std::auto_ptr
Shared-Ownership Pointers
std::shared_ptr
std::weak_ptr
Function Objects
Reference Wrappers
Predefined Functors
Generic Function Wrappers
Binding Function Arguments
Functors for Class Members
Initializer Lists
Date and Time Utilities
Durations
Time Points
Clocks
C-style Date and Time Utilities
C-Style File Utilities
Type Utilities
Runtime Type Identification ,
Type Traits
Type Classification
Type Properties
Type Property Queries
Type Comparisons
Type Transformations
Chapter 3: Containers
Iterators
Iterator Tags
Non-Member Functions to Get Iterators
Non-Member Operations on Iterators
Sequential Containers
std::vector
Construction
Iterators
Accessing Elements
Adding Elements
Size and Capacity
Removing Elements
Remove-Erase Idiom
std::vector
Complexity
std::deque
Complexity
std::array
Complexity
std::list and std::forward_list ,
Complexity
List-Specific Algorithms
Sequential Containers Reference
Iterators
Size and Capacity
Access
Modifiers
Non-Member Functions
std::bitset
Complexity
Reference
Access
Operations
Container Adaptors
std::queue
std::priority_queue
std::stack
Example
Reference
Ordered Associative Containers
std::map and std::multimap
std::set and std::multiset
Searching
Order of Elements
Complexity
Reference
Iterators
Size
Access and Lookup
Modifiers
Observers
Non-Member Functions
Unordered Associative Containers ,
Hash Map
Template Type Parameters
Hash Functions
Complexity
Reference
Observers
Bucket Interface
Hash Policy
Non-Member Functions
Allocators
Chapter 4: Algorithms
Input and Output Iterators
Algorithms
Terminology
General Guidelines
Applying a Function on a Range
Example
Checking for the Presence of Elements
Example
Finding Elements
Example
Binary Search
Example
Subsequence Search
Min/Max
Sequence Comparison
Copy, Move, Swap
Generating Sequences
Example
Removing and Replacing
Example
Reversing and Rotating
Example
Partitioning
Sorting
Example
Shuffling
Example
Operations on Sorted Ranges
Permutation
Heaps
Numeric Algorithms
Example
Iterator Adaptors
Chapter 5: Stream I/O
Input and Output with Streams
Helper Types
std::ios_base
I/O Manipulators ,
Example
std::ios
Error Handling
std::ostream
Example
std::istream
Example
std::iostream
String Streams
Example
File Streams
Example
operator<< and >> for Custom Types
Stream Iterators
std::ostream_iterator
std::istream_iterator
Stream Buffers
C-Style Output and Input
std::printf() Family
Example
std::scanf() Family
Example
Chapter 6: Characters and Strings
Strings
Searching in Strings
Modifying Strings
Constructing Strings
String Length
Copying (Sub)Strings
Comparing Strings
String Conversions
Character Classification ,
Character-Encoding Conversion ,
Localization
Locale Names
The Global Locale
Basic std::locale Members
Locale Facets
Numeric Formatting
Numeric Punctuation
Formatting and Parsing of Numeric Values
Monetary Formatting
Monetary Punctuation
Formatting and Parsing of Monetary Values
Time and Date Formatting
Character Classification, Transformation, and Conversion
Character Classification and Transformation
Character-Encoding Conversions
String Ordering and Hashing
Message Retrieval
Combining and Customizing Locales
Combining Facets
Custom Facets
C Locales
Regular Expressions
The ECMAScript Regular Expression Grammar
Character Classes
Greedy vs. Non-Greedy Quantification
Regular Expression Objects
Construction and Syntax Options
Basic Member Functions
Matching and Searching Patterns
Match Results
std::sub_match
std::match_results
Example
Match Iterators
Replacing Patterns
Chapter 7: Concurrency
Threads
Launching a New Thread
A Thread’s Lifetime
Thread Identifiers
Utility Functions
Exceptions
Futures
Return Objects
Providers
Async
Packaged Tasks
Promises
Exceptions
Mutual Exclusion
Mutexes and Locks
Example
Mutex Types
Common Functionality
Recursion
Timeouts
Sharing Ownership
Lock Types
std::lock_guard
std::unique_lock
std::shared_lock
Locking Multiple Mutexes
Exceptions
Calling a Function Once
Condition Variables
Waiting for a Condition
Notification
Exceptions
Synchronization
Atomic Operations
Atomic Variables
Template Specializations and Typedefs
Common Atomic Operations
Atomic Operations for Integral and Pointer Types
Synchronization
Atomic Flags
Nonmember Functions
Fences
Chapter 8: Diagnostics
Assertions
Exceptions ,
Exception Pointers
Nested Exceptions
System Errors
std::error_category
std::error_code
std::error_condition
C Error Numbers
Failure Handling
std::uncaught_exception()
std::terminate()
std::unexpected()
Appendix A: Standard Library Headers
Numerics and Math (Chapter 1)
General Utilities (Chapter 2)
Containers (Chapter 3)
Algorithms (Chapter 4)
Stream I/O (Chapter 5)
Characters and Strings (Chapter 6)
Concurrency (Chapter 7)
Diagnostics (Chapter 8)
The C Standard Library
Index