Table Of ContentC++ Library Reference
Introduction · Table of Contents · ISO Technical Reports · Overviews ·
Implementation Dependence
Introduction
Originally published by ANSI in 1989 (C89), the C Standard was adopted by ISO in
1990 (C90). It was augmented with stronger support for wide characters in 1995 (C95),
then with considerable additional support for floating-point operations in 1999 (C99).
A bug fix release was published in 2003 (C03), then support for multithreading was
added in 2011 (C11). Probably the most widely used versions of Standard C today are
C90 and C03. This C++ Library Reference endeavors to note when any features have
been added or removed since C89.
The C++ Standard, originally published by ISO in 1998 (C98) includes the C95
Standard by reference. A bug fix release was published in 2003 (C++03), then a
significantly enhanced update in 2011 (C++11), and another in 2014 (C++14). At this
writing, another update is proposed for 2017 (C++17). C++11 and subsequent releases
include the C03 Standard by reference. This C++ Library Reference indicates changes
to Standard C required for use with C++.
The Standard C++ library includes a large number of classes and functions that perform
essential services such as input/output and storage allocation. It supplies efficient
implementations of frequently used operations. Numerous other classes, functions, and
type definitions accompany these classes and functions to help you to make better use of
the libraries.
Table of Contents
The Standard C++ Library is organized into a number of headers, files that you include
in your program to declare or define library facilities. Thus, most of the material in this
C++ Library Reference is organized by headers, listed below to simplify top-down
searching. Some headers are identified as part of the Standard Template Library, or
STL for short, since this was a major addition to C++98.
The traditional Standard C++ library headers (C++03) are:
<algorithm> -- (STL) for defining numerous templates that implement useful
algorithms
<bitset> -- for defining a template class that administers sets of bits
<complex> -- for defining a template class that supports complex arithmetic
<deque> -- (STL) for defining a template class that implements a deque container
<exception> -- for defining several functions that control exception handling
<fstream> -- for defining several iostreams template classes that manipulate external
files
<functional> -- (STL) for defining several templates that help define and manipulate
functions
<iomanip> -- for declaring several iostreams manipulators that take an argument
<ios> -- for defining the template class that serves as the base for many iostreams
classes
<iosfwd> -- for declaring several iostreams template classes before they are
necessarily defined
<iostream> -- for declaring the iostreams objects that manipulate the standard streams
<istream> -- for defining the template class that performs extractions
<iterator> -- (STL) for defining several templates that help define and manipulate
iterators
<limits> -- for testing numeric type properties
<list> -- (STL) for defining a template class that implements a doubly linked list
container
<locale> -- for defining several classes and templates that control locale-specific
behavior, as in the iostreams classes
<map> -- (STL) for defining template classes that implement associative containers that
map keys to values
<memory> -- (STL) for defining several templates that allocate and free storage for
various container classes
<new> -- for declaring several functions that allocate and free storage
<numeric> -- (STL) for defining several templates that implement useful numeric
functions
<ostream> -- for defining the template class that performs insertions
<queue> -- (STL) for defining a template class that implements a queue container
<set> -- (STL) for defining template classes that implement associative containers
<sstream> -- for defining several iostreams template classes that manipulate string
containers
<stack> -- (STL) for defining a template class that implements a stack container
<stdexcept> -- for defining several classes useful for reporting exceptions
<streambuf> -- for defining template classes that buffer iostreams operations
<string> -- for defining a template class that implements a string container
<strstream> -- for defining several iostreams classes that manipulate in-memory
character sequences
<typeinfo> -- for defining class type_info, the result of the typeid operator
<utility> -- (STL) for defining several templates of general utility
<valarray> -- for defining several classes and template classes that support value-
oriented arrays
<vector> -- (STL) for defining a template class that implements a vector container
The Standard C Library headers come in two forms, new (C++03) and traditional
(C03). The new-form headers are:
<cassert> -- for enforcing assertions when functions execute
<ccomplex> -- for performing complex arithmetic
<cctype> -- for classifying characters
<cerrno> -- for testing error codes reported by library functions
<cfenv> -- for controlling IEEE-style floating-point arithmetic
<cfloat> -- for testing floating-point type properties
<cinttypes> -- for converting various integer types
<ciso646> -- for programming in ISO 646 variant character sets
<climits> -- for testing integer type properties
<clocale> -- for adapting to different cultural conventions
<cmath> -- for computing common mathematical functions
<csetjmp> -- for executing nonlocal goto statements
<csignal> -- for controlling various exceptional conditions
<cstdarg> -- for accessing a varying number of arguments
<cstdbool> -- for defining a convenient Boolean type name and constants
<cstddef> -- for defining several useful types and macros
<cstdint> -- for defining various integer types with size constraints
<cstdio> -- for performing input and output
<cstdlib> -- for performing a variety of operations
<cstring> -- for manipulating several kinds of strings
<ctgmath> -- for defining generic forms of math functions
<ctime> -- for converting between various time and date formats
<cwchar> -- for manipulating wide streams and several kinds of strings
<cwctype> -- for classifying wide characters
Added with C++11 are:
<array> -- for defining a fixed-size array with a container-like interface
<atomic> -- for defining classes and objects that manage atomic data operations
<chrono> -- for defining time points and durations
<codecvt> -- for defining locale facets that convert between different Unicode
encodings
<condition_variable> -- for defining classes that manage inter-thread
synchronization
<cstdalign> -- for ensuring that alignas is defined
<cuchar> -- for manipulating 16-bit and 32-bit UNICODE wide characters
<forward_list> -- (STL) for defining a template class that implements a small-
footprint singly linked list container
<future> -- for defining classes and objects that simplify communicating between
threads
<initializer_list> -- for describing a brace-enclosed initializer list
<mutex> -- for defining classes that manage mutual exclusion between threads
<random> -- for defining random number generators
<ratio> -- for defining templates that implement compile-time rational numbers
<regex> -- for defining a regular-expression matcher
<scoped_allocator> -- for wrapping a nest of allocators
<system_error> -- for wrapping low-level system errors
<thread> -- for defining classes and functions to create and manage threads
<tuple> -- for defining an ordered collection of subobjects
<typeindex> -- for defining classes and functions to index typeinfo objects
<type_traits> -- for accessing detailed type information at compile time to support
generic programming
<unordered_map> -- (STL) for defining template classes that implement unordered
associative containers that map keys to values
<unordered_set> -- (STL) for defining template classes that implement unordered
associative containers
<typeindex> -- for defining classes and functions to index typeinfo objects
Added with C++14 is:
<shared_mutex> -- for defining additional classes that manage mutual exclusion
between threads
The traditional Standard C library headers (C03), also a part of C++11 and subsequent
versions, are:
<assert.h> -- for enforcing assertions when functions execute
<complex.h> -- for performing complex arithmetic
<ctype.h> -- for classifying characters
<errno.h> -- for testing error codes reported by library functions
<fenv.h> -- for controlling IEEE-style floating-point arithmetic
<float.h> -- for testing floating-point type properties
<inttypes.h> -- for converting various integer types
<iso646.h> -- for programming in ISO 646 variant character sets
<limits.h> -- for testing integer type properties
<locale.h> -- for adapting to different cultural conventions
<math.h> -- for computing common mathematical functions
<setjmp.h> -- for executing nonlocal goto statements
<signal.h> -- for controlling various exceptional conditions
<stdarg.h> -- for accessing a varying number of arguments
<stdbool.h> -- for defining a convenient Boolean type name and constants
<stddef.h> -- for defining several useful types and macros
<stdint.h> -- for defining various integer types with size constraints
<stdio.h> -- for performing input and output
<stdlib.h> -- for performing a variety of operations
<string.h> -- for manipulating several kinds of strings
<tgmath.h> -- for declaring various type-generic math functions
<time.h> -- for converting between various time and date formats
<wchar.h> -- for manipulating wide streams and several kinds of strings
<wctype.h> -- for classifying wide characters
Added with C11 (and not required by C++11 or subsequent versions) are:
<stdalign.h> -- for ensuring that the macro alignas is defined
<stdatomic.h> -- for defining types and functions that manage atomic data operations
<stdnoreturn.h> -- for ensuring that the macro noreturn is defined
<threads.h> -- for for defining types and functions to create and manage threads
<uchar.h> -- for manipulating 16-bit and 32-bit UNICODE wide characters
ISO Technical Reports
An important stepping stone from C++03 to C++11 first appeared in the ISO Technical
Report TR19768 (better known as Library TR1). Its numerous contributions to C++11
are identified, as much as possible, by the tag [added with C++11].
This C++ Library Reference also describes several additions, not currently required by
the C or C++ Standards, but defined in other ISO Technical Reports. The additions to C
are:
<iohw.h> [added with TR18015/TR18037] -- for writing portable I/O hardware
drivers in C
<stdfix.h> [added with TR18037] -- for performing fixed-point arithmetic in C
ISO/IEC TR24731 defines C Library Extension 1, which adds a number of functions to
existing headers that check arguments for unexpected null pointers, short buffers, and
other common errors. The functions are based on additions made by Microsoft to Visual
C++ 2005 (V8). The contributions occur in <errno.h>, <stddef.h>, <stdint.h>,
<stdio.h>, <stdlib.h>, <string.h>, <time.h>, and <wchar.h>.
ISO/IEC IS24747 defines Special Math Functions, such as Bessel functions and
elliptical integrals. The contributions occur in <math.h>,
Standard C++ is now in a state of continual evolution, as indicated by the sequence
C++11, C++14, C++17. To smooth transitions, technical reports sometimes provide an
early glimpse of features to come, often defining new library features only in special
namespaces such as std::experimental. Note, however, that this C++ Library
Reference omits such interim names.
The additions to C++ are:
<hardware> [added with TR18015] -- for writing portable I/O hardware drivers in
C++
<filesystem> [added with TS18822] -- for manipulating files and directories in C++
<barrier> [added with TS19571] -- for synchronizing one or more threads
<latch> [added with TS19571] -- for synchronizing one or more threads
TS19571 also adds several new featues to <atomic> and <future>.
Overviews
Other information on the Standard C and C++ libraries includes several overviews:
C++ Library Overview -- how to use the Standard C++ library, including alternative
mechanisms for handling exceptions
C Library Overview -- how to use the Standard C library, including what happens at
program startup and at program termination
Characters -- how to write character constants and string literals, and how to convert
between multibyte characters and wide characters
Files and Streams -- how to read and write data between the program and files
Formatted Output -- how to generate text under control of a format string
Formatted Input -- how to scan and parse text under control of a format string
STL Conventions -- how to read the descriptions of STL template classes and
functions
STL Containers -- how to use an arbitrary STL container template class
Random Number Generators -- how to use the generators and distributions defined in
<random>
Regular Expressions -- how to write regular expressions defined in <regex>
Implementation Dependence
As much as possible, this Reference describes behavior common to all conforming
implementations. Where implementation-defined behavior benefits from a particular
example,
Copyright © 1992-2015 by P.J. Plauger. All rights reserved.