Standard Library Headers - Springer978-1-4842-1876... · 2017-08-26 · P. Van Weert and M. Gregoire, C++ Standard Library Quick Reference , DOI 10.1007/978-1-4842-1876-1 APPENDIX
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
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.
<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 .
<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> .
<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.
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() .
<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() .