Appendix A: Standard Library Headers

The C++ Standard Library consists of 79 header files, of which 26 are adapted from the C Standard Library. This appendix gives a brief description of each.
For each < name .h> header from the C Standard Library, there is a corresponding <c name > C++ Standard Library header (note the c prefix). These C++ headers put all functionality provided by the C library in the std namespace. It is implementation-defined whether the types and functions still appear in the global namespace. The use of the original <name.h> headers is deprecated.
Headers are shown in the order in which they are presented in each chapter. Functionality not discussed in this book is shown in italic.

Numerics and Math (Chapter 1 )

Header
Contents
<cmath>
Math functions, such as exp() , sqrt() , log() , abs() , all trigonometric functions, and more.
<cstdint>
A set of typedef s for integral types with certain width requirements: for example, int32_t and int_fast64_t .
<limits>
numeric_limits , offering properties—such as min() , max() , lowest() , infinity() , quiet_NaN() , and so on—for all built-in arithmetic types.
<climits>
Macros for C-style limits of integral types, such as INT_MAX . Subsumed by <limits> .
<cfloat>
Macros to describe details of the floating-point types of your environment, e.g. FLT_EPSILON , FLT_MAX , and so on. Subsumed by <limits> .
<cfenv>
Advanced access to the floating-point environment to configure floating-point exceptions, rounding, and other environment settings.
<complex>
The complex class for working with complex numbers.
<ccomplex>
Simply includes <complex> .
<ctgmath>
Includes <cmath> and <ccomplex> .
<ratio>
The ratio template, helper templates for performing arithmetic operations and comparisons on them, and a set of predefined ratio s.
<random>
Pseudo-random number generators, random_device , and various random number distributions.
<valarray>
valarray functionality for working with arrays of numeric values.

General Utilities (Chapter 2 )

Header
Contents
<utility>
pair and piecewise_construct . Functions make_pair() , swap() , forward() , move() , move_if_noexcept() , and declval() .
<tuple>
tuple , helper classes tuple_size and tuple_element , and functions make_tuple() , forward_as_tuple() , tie() , tuple_cat() , and get() .
<memory>
Smart pointers: unique_ptr , shared_ptr , and weak_ptr . Default allocators.
<new>
Functions for managing dynamic storage: operators new , new[] , delete , and delete[] , get_ and set_new_handler() , and exceptions bad_alloc and bad_array_new_length .
<functional>
Reference wrappers (created with ref() / cref() ), predefined functors (function objects), functor negators, std::function , bind() , and mem_fn() .
<initializer_list>
The definition of initializer_list .
<chrono>
Time utilities: duration s, time_point s, and clocks ( steady_clock , system_clock , and high_resolution_clock ).
<ctime>
C-style time and date utilities such as the tm struct , time() , localtime() , and strftime() .
<cstdio>
C-style file utilities: remove() , rename() , tmpfile() , and tmpnam() . Also provides C-style stream I/O functionality: see Chapter 5 .
<typeinfo>
type_info , and the exceptions bad_cast and bad_typeid .
<typeindex>
type_index , a wrapper for type_info to be able to use it as a key in associative containers.
<type_traits>
Template-based type traits for compile-time manipulation and inspection of properties of types.

Containers (Chapter 3 )

Header
Contents
<iterator>
Functions to perform operations on iterators: advance() , distance() , begin() , end() , prev() , and next() , and the iterator tags. Chapter 4 discusses input/output iterators and the predefined iterator adaptors: reverse_iterator , move_iterator , and insert iterators. Stream iterators are discussed in Chapter 5 .
<vector>
The vector class template and the vector<bool> specialization.
<deque>
The deque class template.
<array>
The array class template.
<list>
The list class template.
<forward_list>
The forward_list class template.
<bitset>
The bitset class template.
<queue>
The queue and priority_queue class templates.
<stack>
The stack class template.
<map>
The map and multimap class templates.
<set>
The set and multiset class templates.
<unordered_map>
The unordered_map and unordered_multimap class templates.
<unordered_set>
The unordered_set and unordered_multiset class templates.

Algorithms (Chapter 4 )

Header
Contents
<algorithm>
All available algorithms, except those that are in <numeric> .
<numeric>
Numerical algorithms: accumulate() , adjacent_difference() , inner_product() , partial_sum() , and iota() .

Stream I/O (Chapter 5 )

Header
Contents
<ios>
ios_base , basic_ios , and fpos , typedef s ios and wios , and types streamoff , streampos , wstreampos , and streamsize . Non-parametric I/O manipulators such as boolalpha , dec , scientific , and so on.
<iomanip>
Parametric I/O manipulators such as setbase() , setfill() , get_money() , put_time() , and more.
<ostream>
basic_ostream , and typedef s ostream and wostream . The endl , ends , and flush output manipulators.
<istream>
basic_istream and basic_iostream , and typedef s istream , wistream , iostream , and wiostream . The ws input manipulator.
<iostream>
cin / wcin , cout / wcout , cerr / wcerr , and clog / wclog . Includes <ios> , <streambuf> , <istream> , <ostream> , and <iosfwd> .
<sstream>
String streams: basic_istringstream , basic_ostringstream , basic_stringstream , basic_stringbuf , and related typedef s.
<fstream>
File streams: basic_ifstream , basic_ofstream , basic_fstream , and basic_filebuf , and related typedef s.
<streambuf>
basic_streambuf , and typedef s streambuf and wstreambuf .
<iosfwd>
Forward declarations for all stream I/O types.
<cstdio>
The C-style I/O library. Basic file utilities (see Chapter 2 ) , plus fopen() , fclose() , and so on. Functions for formatted ( printf() , scanf() , and so on ) and character-based I/O ( getc() , putc() , and so on ). It is generally recommended that you use C++ I/O streams.
<cinttypes>
Macros to use with printf() and scanf() to handle the fixed-width integer types of <cstdint> . Subsumed by C++ I/O streams.
<strstream>
Deprecated.

Characters and Strings (Chapter 6 )

Header
Contents
<string>
basic_string , and typedef s string , wstring , u16string , and u32string . Conversion functions such as stoi() , stof() , to_string() , and so on.
<cstring>
Low-level memory functions: memcpy() , memmove() , memcmp() , memchr() , and memset() . A collection of C-style string functions, e.g. strcpy() and strcat() , and a definition for NULL and size_t .
<cwchar>
Functions to work with C-style wide character strings, such as fputws() , wprintf() , wcstof() , wcscat() , wmemset() , and so on.
<cctype>
Functions to classify and transform characters: isdigit() , isspace() , tolower() , toupper() , and so on.
<cwctype>
Wide character versions of functions from <cctype> : iswdigit() , iswspace() , towlower() , towupper() , and so on.
<codecvt>
Unicode character encoding conversion facets: codecvt_utf8 , codecvt_utf16 , and codecvt_utf8_utf16 .
<cuchar>
Functions to convert between 16 or 32-bit character and multibyte sequences: c16rtomb() , c32rtomb() , mbrtoc16() , and mbrtoc32() .
<locale>
The locale class, overloads of <cctype> functions accepting a given locale , facet functions use_facet() and has_facet() , and standard facet classes num_get , collate , money_put , codecvt , and so on.
<clocale>
lconv and the setlocale() and localeconv() functions. setlocale() only changes the C locale.
<regex>
Everything related to regular expressions.

Concurrency (Chapter 7 )

Header
Contents
<thread>
The thread class and the this_thread namespace.
<future>
future and shared_future , future_error , and providers promise , packaged_task , and async() .
<mutex>
mutex , recursive_mutex , timed_mutex , recursive_timed_mutex , lock_guard , unique_lock , and related types. Functions try_lock() , lock() , and call_once() .
<shared_mutex>
shared_mutex , shared_timed_mutex , and shared_lock .
<condition_variable>
condition_variable and condition_variable_any , and the function notify_all_at_thread_exit() .
<atomic>
Atomic types and fences.

Diagnostics (Chapter 8 )

Header
Contents
<cassert>
The assert() macro.
<exception>
exception and bad_exception , exception pointers, nested exceptions, terminate, and unexpected handlers.
<stdexcept>
Exception classes for reporting common errors: logic_error , runtime_error , and their generic subclasses.
<system_error>
The std::system_error exception used to report low-level errors, and the concepts of error codes, conditions, and categories.
<cerrno>
The errno expression and default error-condition values.

The C Standard Library

This section lists the remaining C headers that are not mentioned earlier.
Header
Contents
<ciso646>
Only useful for C. Defines macros such as and , or , not , and so on. In C++, those are reserved words, so this header is empty.
<csetjmp>
longjmp() and setjmp() . Do not use these in C++.
<csignal>
signal() and raise() . Do not use these in C++.
<cstdalign>
The __alignas_is_defined macro: always expands to 1 for C++.
<cstdarg>
The va_list type and functions va_start() , va_arg() , va_end() , and va_copy() to handle variable-length argument lists. In C++, it is recommended that you use type-safe variadic templates instead.
<cstdbool>
The __bool_true_false_are_defined macro: expands to 1 for C++.
<cstddef>
Types ptrdiff_t , size_t , max_align_t , and nullptr_t . The macro offsetof() and the constant NULL .
<cstdlib>
String conversion functions: atof() , strtof() , and so on.
Multibyte character functions: mblen() , mbtowc() , and wctomb() .
Multibyte string conversion: mbstowcs() and wcstombs() .
Searching and sorting: bsearch() and qsort() (use <algorithm> ).
Random numbers: rand() and srand() (deprecated; use <random> ).
Memory management: calloc() , free() , malloc() , and realloc() .
Integer functions: abs() , div( ), labs() , ldiv() , llabs() , and lldiv() .
Functions abort() , atexit() , at_quick_exit() , exit() , getenv() , quick_exit() , system() , and _Exit() .
Index
A
abs()
accumulate()
acos()
acosh()
add_x type trait
adjacent_difference()
adjacent_find()
adjustfield
ADL
adopt_lock
advance()
<algorithm>
Aliasing
alignment_of
all_of()
Allocators
any_of()
app
Append
arg()
Argument-dependent lookup (ADL)
Arithmetic type properties
array
ASCII
asctime()
As-if rule
asin()
asinh()
Assertions
Associative containers
ordered
unordered
async()
Asynchronous programming
See alsoFutures
atan()
atan2()
atanh()
ate
Atomic variables
compare_exchange()
construction
exchange()
integral and pointer types
lock_free()
nonmember functions
specializations
store() and load()
synchronization
atomic_flag
atomic_signal_fence()
atomic_thread_fence()
auto_ptr
B
back_inserter()
back_insert_iterator
bad_alloc
bad_array_new_length
badbit
bad_cast
bad_exception
bad_function_call
bad_typeid
bad_weak_ptr
basefield
basic_string
begin()
bernoulli_distribution
binary
binary_function
binary_negate
binary_search()
bind()
Binding function arguments
bind2nd()
bind1st()
binomial_distribution
bit_and
bit_not
bit_or
bitset
bit_xor
boolalpha
C
call_once()
Capacity
CAS operations
<cassert>
cauchy_distribution
cbegin()
cbrt()
<cctype>
ceil()
cend()
cerr
C error numbers
<cerrno>
Character classes
Character classification
Character-encoding conversion
Character encodings
char16_t
char32_t
chi_squared_distribution
<chrono>
chrono_literals
cin
classic()
<clocale>
“C” locale
C locales
clock()
Clocks
CLOCKS_PER_SEC
clock_t
clog
Closure
cmatch
<cmath>
<codecvt>
collate
common_type
Compare-and-swap
<complex>
complex_literals
Complex numbers
Concatenate
<condition_variable>
condition_variable_any
Condition variables
exceptions
notification
synchronization
timeouts
waiting
conditional
conj()
Container adaptors
Containers
copy()
copy_backward()
copy_if()
copy_n()
copysign()
cos()
cosh()
count()
count_if()
cout
crbegin()
cref()
crend()
Critical section
See alsoMutexes
<cstdint>
<cstdio>
C-style date and time utilities
csub_match
ctime()
<ctime>
ctype
Currency symbol
current_exception()
<cwctype>
D
Data race
Date formatting
Date utilities
Deadlock
dec
decay
Decimal separator
defaultfloat
default_random_engine
defer_lock
deque
Difference
difftime()
Digit grouping
discard_block_engine
discrete_distribution
distance()
Distribution
See.Random number distributions
divides
domain_error
Dot product
Double-checked locking
Double-ended queue
Doubly linked list
duration
duration_cast()
E
ECMAScript grammar
See.Regular expressions
Emplacement
enable_if
end()
endl
ends
eofbit
Epoch
Epsilon
equal()
equal_range()
equal_to
erf()
erfc()
errc
errno
error_category
error_code
error_condition
Exception pointers
exception_ptr
Exceptions
Exceptions class hierarchy
exchange()
exp()
exp2()
expm1()
exponential_distribution
extent
extreme_value_distribution
F
fabs()
Facets
See alsoLocalization
failbit
failure
fdim()
Fences
File streams
File utilities
fill()
Fill character
fill_n()
find()
find_end()
find_first_of()
find_if()
find_if_not()
Fire-and-forget
First-in first-out (FIFO)
fisher_f_distribution
fixed
Fixed-width integer types
floatfield
Floating-point numbers
Epsilon
Infinity
NaN
floor()
flush
fma()
fmax()
fmin()
fmod()
fmtflags
for_each()
Formatting
See also to_string() ; printf() ; and Stream I/O
date
monetary
numerical
time
forward()
forward_as_tuple()
Forwarding reference
forward_list
fpclassify()
FP_INFINITE
FP_NAN
FP_NORMAL
fpos
fprintf()
FP_SUBNORMAL
FP_ZERO
frexp()
front_inserter()
front_insert_iterator
fscanf()
<fstream>
function
Function object
for class members
<functional>
Functor
future_errc
future_error
Futures
exceptions
providers
async()
packaged tasks
promises
shared state
synchronization
G
gamma_distribution
generate()
generate_canonical
generate_n()
Generic function wrappers
geometric_distribution
get()
getline()
get_money()
get_terminate()
get_time()
get_unexpected()
global()
gmtime()
goodbit
Grammar
printf()
regular expressions
scanf()
time and date formatting
greater
greater_equal
gslice
H
hardware_concurrency()
has_facet()
Hash functions
Hash map
Header
<algorithm>
<array>
<atomic>
<bitset>
<cassert>
<cctype>
<cerrno>
<chrono>
<clocale>
<cmath>
<codecvt>
<complex>
<condition_variable>
<cstdint>
<cstdio>
<ctime>
<cwctype>
<deque>
<exception>
<forward_list>
<fstream>
<functional>
<future>
<initializer_list>
<iomanip>
<ios>
<istream>
<iterator>
<limits>
<list>
<locale>
<map>
<memory>
<mutex>
<numeric>
<ostream>
<queue>
<random>
<ratio>
<regex>
<set>
<shared_mutex>
<sstream>
<stack>
<stdexcept>
<streambuf>
<string>
<system_error>
<thread>
<tuple>
<typeindex>
<typeinfo>
<type_traits>
<unordered_map>
<unordered_set>
<utility>
<valarray>
<vector>
Heaps
hex
hexfloat
high_resolution_clock
hypot()
I, J
ifstream
ilogb()
imag()
I18n
See.Localization
in
includes()
independent_bits_engine
indirect_array
Infinity
<initializer_list>
Initializer-list constructors
inner_product()
inplace_merge()
Input streams
See.Stream I/O
inserter()
insert_iterator
internal
Internationalization
See.Localization
Intersection
int_fast X _t
int_least X _t
intmax_t
intptr_t
int X _t
invalid_argument
I/O
See.Stream I/O
I/O Manipulator
See.Stream I/O
<iomanip>
ios_base
<ios>
iostate
iostream
iota()
is_base_of
is_convertible
is_error_code_enum
is_error_condition_enum
isfinite()
isgreater()
isgreaterequal()
is_heap()
is_heap_until()
isinf()
isless()
islessequal()
islessgreater()
is_literal_type
isnan()
isnormal()
is_partitioned()
is_permutation()
is_pod
is_same
is_sorted()
is_sorted_until()
is_standard_layout
<istream>
istream_iterator
istringstream
is_trivial
isunordered()
<iterator>
Iterator adaptors
Iterators
bidirectional
categories
forward
input
output
random
stream iterators
tags
iter_swap()
K
knuth_b
L
Lambda expressions
Last-in first-out (LIFO)
Launch policy
Lazy initialization
LC_ALL , LC_COLLATE …
ldexp()
left
length_error
less
less_equal
lexicographical_compare()
lgamma()
<limits>
linear_congruential_engine
Line-by-line input
list
List-specific algorithms
llrint()
llround()
localeconv()
Localization
C locales
combining facets
custom facets
global locale
locale facet categories
locale facets
locale names
standard facets
character classification and transformation
character-encoding conversions
formatting and parsing, monetary values
formatting and parsing, numeric values
formatting and parsing, time and dates
message retrieval
monetary punctuation
numeric punctuation
string ordering and hashing
std::locale
localtime()
lock()
Lock-free data structures
lock_guard
Locks
See.Mutexes
log()
log2()
log10()
logb()
logical_and
logical_not
logical_or
logic_error
lognormal_distribution
log1p()
lower_bound()
lrint()
lround()
M
Magic statics
main()
make_error_code()
make_error_condition()
make_exception_ptr()
make_heap()
make_move_iterator()
make_pair()
make_reverse_iterator()
make_shared()
make_tuple()
make_unique()
make_y
Manipulator
See.Stream I/O
map
mask_array
match_flag_type
match_results
Mathematical functions
basic functions
classification functions
comparison functions
error functions
error handling
exponential functions
floating-point manipulation functions
gamma functions
hyperbolic functions
logarithmic functions
power functions
rounding of floating-point numbers
trigonometric functions
MATH_ERREXCEPT
math_errhandling
MATH_ERRNO
max()
max_element()
Maximum representable number
Member function object
mem_fn()
mem_fun()
mem_fun_ref()
Memory model
memory_order
<memory>
merge()
mersenne_twister_engine
messages
min()
min_element()
Minimum representable number
minmax()
minmax_element()
minstd_rand
minstd_rand0
minus
mismatch()
mktime()
modf()
modulus
Monetary formatting
money_get
moneypunct
money_put
move()
move_backward()
move_if_noexcept()
move_iterator
Move semantics
mt19937
mt19937_64
multimap
multiplies
multiset
Mutexes
critical section
exceptions
locking
locking multiple mutexes
lock types
lock_guard
shared_lock
unique_lock
native_handle()
RAII
readers-writers
recursion
reentry
sharing ownership
synchronization
timeouts
N
NaN
nan()
nanf()
nanl()
NDEBUG
nearbyint()
negate
negative_binomial_distribution
nested_exception
Neutral locale
next()
nextafter()
next_permutation()
nexttoward()
none_of()
norm()
normal_distribution
not1()
not2()
not_equal_to
notify_all_at_thread_exit()
npos
nth_element()
<numeric>
Numerical formatting
numeric_limits
num_get
numpunct
num_put
O
oct
ofstream
once_flag
openmode
operator<< and >> , custom types
Ordered associative containers
<ostream>
ostream_iterator
ostringstream
out
out_of_range
Output streams
See.Stream I/O
overflow_error
P
packaged_task
pair
Parsing
See . stoi() ; scanf() ; Regular expressions; Stream I/O
partial_sort()
partial_sort_copy()
partial_sum()
partition()
partition_copy()
partition_point()
Perfect forwarding
Permutations
perror()
Person class
piecewise_constant_distribution
Piecewise construction
piecewise_linear_distribution
plus
poisson_distribution
polar()
pop_heap()
POSIX error codes
pow()
Predefined functors
prev()
prev_permutation()
printf()
conversion specifiers
flags
formatting syntax
length modifiers
priority_queue
proj()
promise
ptr_fun()
push_heap()
put_money()
put_time()
Q
queue
quoted()
R
RAII
rand()
<random>
random_device
Random number distributions
Bernoulli
Normal
Poisson
Sampling
Discrete
Piecewise constant
Piecewise linear
Uniform
Random number generators
Non-deterministic
Pseudorandom number engines
Engine adaptors
Predefined engines
Random numbers
Seeding
random_shuffle()
range_error
rank
ranlux24
ranlux24_base
ranlux48
ranlux48_base
<ratio>
ratio_add
ratio_divide
ratio_equal
ratio_multiply
Rational numbers
ratio_subtract
rbegin()
Readers-writers locks
See.Mutexes
real()
recursive_mutex
recursive_timed_mutex
ref()
reference_wrapper
Reference wrappers
<regex>
regex_error
regex_iterator
regex_match()
regex_replace()
regex_search()
regex_token_iterator
Regular expressions
grammar
assertions
atoms
back reference
character classes
disjunction
greediness
lookahead
quantifiers
grammar options
matching and searching patterns
match iterators
match results
raw string literals
replacing patterns
std::regex
Relational operators
rel_ops
remainder()
remove()
remove_copy()
remove_copy_if()
Remove-erase idiom
remove_if()
remove_x type trait
remquo()
rename()
rend()
replace()
replace_copy()
replace_copy_if()
replace_if()
resetiosflags()
Resource Acquisition Is Initialization
See.RAII
result_of
rethrow_exception()
rethrow_if_nested()
reverse()
reverse_copy()
Reverse iterator
reverse_iterator
right
rint()
rotate()
rotate_copy()
round()
runtime_error
Runtime type identification
S
scalbln()
scalbn()
scanf()
conversion specifiers
formatting syntax
length modifiers
scientific
search()
search_n()
seekdir
Selection algorithm
Sequence comparison
Sequential containers
reference
set
setbase()
set_difference()
setfill()
set_intersection()
setiosflags()
setlocale()
setprecision()
set_symmetric_difference()
set_terminate()
set_unexpected()
set_union()
setw()
SFINAE
shared_future
shared_lock
shared_mutex
shared_ptr
shared_timed_mutex
showbase
showpoint
showpos
shuffle()
shuffle_order_engine
signbit()
sin()
Singleton
sinh()
SI ratios
skipws
Sleeping
slice
Smart pointers
See alsoRAII
smatch
sort()
sort_heap()
Splicing
Splitting strings
See . regex_token_iterator
sprintf()
Spurious wakeups
sqrt()
sscanf()
<sstream>
ssub_match
stable_partition()
stable_sort()
stack
Standard Template Library
std
stderr
<stdexcept>
stdin
stdout
steady_clock
STL
stof() , stod() , stold()
stoi() , stol() , stoll() , stoul() , stoull()
Stream Buffers
Stream I/O
class hierarchy
default initialization
error handling
file streams
formatting flags
helper types
I/O manipulators
input streams
open modes
output streams
standard input streams
standard output streams
redirect
state bits
stream iterators
string streams
thread safety
<streambuf>
streamoff
streamsize
strerror()
strftime()
string_literals
Strings
comparing
constructing
formatting
See also(Formatting
length
modifying
npos
parsing
See also(Parsing
searching
string literal operator
substrings
types
String streams
student_t_distribution
sub_match
Subsequence search
Substrings
subtract_with_carry_engine
swap()
swap_ranges()
Symmetric difference
Synchronization
See alsoMemory model
sync_with_stdio()
system_clock
system_error
T
tan()
tanh()
terminate()
tgamma()
Thousands separator
Threads
exceptions
fire-and-forget
identifiers
joining
launching
sleeping
synchronizing
yielding
throw_with_nested()
tie()
time()
timed_mutex
Time formatting
time_get
time_point
time_point_cast()
time_put
time_t
Time utilities
tm
tmpfile()
tmpnam()
Tokenizing
See . regex_token_iterator
tolower()
Torn reads and writes
See alsoAtomic variables
to_string()
toupper()
transform()
Transparent operator functors
trunc
trunc()
try_lock()
try_to_lock
<tuple>
tuple_element
tuple_size
Type classification
Type comparisons
typeid()
<typeindex>
<typeinfo>
Type properties
Type property queries
<type_traits>
Type traits
Type transformations
U
uint_fast X _t
uint_least X _t
uintmax_t
uintptr_t
uint X _t
unary_function
unary_negate
uncaught_exception()
underflow_error
underlying_type
unexpected()
Unicode
uniform_int_distribution
uniform_real_distribution
Union
unique()
unique_copy()
unique_lock
unique_ptr
unitbuf
Universal reference
Unordered associative containers
unordered_map
unordered_multimap
unordered_multiset
unordered_set
upper_bound()
uppercase
use_facet()
u16string
u32string
UTF-8, UTF-16, UTF-32
<utility>
V
<valarray>
vector
vector<bool>
W, X, Y, Z
wbuffer_convert
wcerr
wchar_t
wcin
wclog
wcmatch
wcout
wcsub_match
weak_ptr
Weak reference
weibull_distribution
ws
wsmatch
wssub_match
wstring
wstring_convert
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset