6.6 C++ Standard Library Headers

The C++ Standard Library is divided into many portions, each with its own header. The headers contain the function prototypes for the related functions that form each portion of the library. The headers also contain definitions of various class types and functions, as well as constants needed by those functions. A header “instructs” the compiler on how to interface with library and user-written components.

Figure 6.5 lists some common C++ Standard Library headers, most of which are discussed later in this book. The term “macro” that’s used several times in Fig. 6.5 is discussed in detail in Appendix E, Preprocessor.

Fig. 6.5 C++ Standard Library headers.

Standard Library header Explanation
<iostream> Contains function prototypes for the C++ standard input and output functions, introduced in Chapter 2, and is covered in more detail in Chapter 13, Stream Input/Output: A Deeper Look.
<iomanip> Contains function prototypes for stream manipulators that format streams of data. This header is first used in Section 4.10 and is discussed in more detail in Chapter 13, Stream Input/Output: A Deeper Look.
<cmath> Contains function prototypes for math library functions (Section 6.3).
<cstdlib> Contains function prototypes for conversions of numbers to text, text to numbers, memory allocation, random numbers and various other utility functions. Portions of the header are covered in Section 6.7; Chapter 11, Operator Overloading; Class string; Chapter 17, Exception Handling: A Deeper Look; Chapter 22, Bits, Characters, C Strings and structs; and Appendix F, C Legacy Code Topics.
<ctime> Contains function prototypes and types for manipulating the time and date. This header is used in Section 6.7.
<array>, <vector>, <list>, <forward_list>, <deque>, <queue>, <stack>, <map>, <unordered_map>, <unordered_set>, <set>, <bitset> These headers contain classes that implement the C++ Standard Library containers. Containers store data during a program’s execution. The <vector> header is first introduced in Chapter 7, Class Templates array and vector; Catching Exceptions. We discuss all these headers in Chapter 15, Standard Library Containers and Iterators. <array>, <forward_list>, <unordered_map> and <unordered_set> were all introduced in C++11.
<cctype> Contains function prototypes for functions that test characters for certain properties (such as whether the character is a digit or a punctuation), and function prototypes for functions that can be used to convert lowercase letters to uppercase letters and vice versa. These topics are discussed in Chapter 22, Bits, Characters, C Strings and structs.
<cstring> Contains function prototypes for C-style string-processing functions.
<typeinfo> Contains classes for runtime type identification (determining data types at execution time). This header is discussed in Section 12.9.
<exception>, <stdexcept> These headers contain classes that are used for exception handling (discussed in Chapter 17, Exception Handling: A Deeper Look).
<memory> Contains classes and functions used by the C++ Standard Library to allocate memory to the C++ Standard Library containers. This header is used in Chapter 17, Exception Handling: A Deeper Look.
<fstream> Contains function prototypes for functions that perform input from and output to files on disk (discussed in Chapter 14, File Processing).
<string> Contains the definition of class string from the C++ Standard Library (discussed in Chapter 21, Class string and String Stream Processing).
<sstream> Contains function prototypes for functions that perform input from strings in memory and output to strings in memory (discussed in Chapter 21, Class string and String Stream Processing).
<functional> Contains classes and functions used by C++ Standard Library algorithms. This header is used in Chapter 16.
<iterator> Contains classes for accessing data in the C++ Standard Library containers. This header is used in Chapter 15.
<algorithm> Contains functions for manipulating data in C++ Standard Library containers. This header is used in Chapter 15.
<cassert> Contains macros for adding diagnostics that aid program debugging. This header is used in Appendix E, Preprocessor.
<cfloat> Contains the floating-point size limits of the system.
<climits> Contains the integral size limits of the system.
<cstdio> Contains function prototypes for the C-style standard input/output library functions.
<locale> Contains classes and functions normally used by stream processing to process data in the natural form for different languages (e.g., monetary formats, sorting strings, character presentation, etc.).
<limits> Contains classes for defining the numerical data type limits on each computer platform—this is C++’s version of <climits> and <cfloat>.
<utility> Contains classes and functions that are used by many C++ Standard Library headers.
..................Content has been hidden....................

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