Appendix C

Standard Library Header Files

The interface to the C++ Standard Library consists of 78 header files, 26 of which present the C standard library. It’s often difficult to remember which header files you need to include in your source code, so this material provides a brief description of the contents of each header, organized into eight categories:

  • The C Standard Library
  • Containers
  • Algorithms, iterators, and allocators
  • General utilities
  • Mathematical utilities
  • Exceptions
  • I/O Streams
  • Threading library

THE C STANDARD LIBRARY

The C++ Standard Library includes the entire C Standard Library. The header files are generally the same, except for two points:

  • The header names are <cname> instead of <name.h>.
  • All the names declared in the header files are in the std namespace.
pen.gif

For backward compatibility, you can still include <name.h> if you want. However, that puts the names into the global namespace instead of the std namespace. We recommend avoiding this feature.

The following table provides a summary of the most useful functionality:

HEADER FILE NAME CONTENTS
<cassert> assert() macro.
image <ccomplex> Utilities to work with complex numbers.
<cctype> Character predicates and manipulation functions, such as isspace() and tolower().
<cerrno> Defines errno expression. ...

Get Professional C++, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.