[contents] describes the entities defined in the C++ standard library. [headers] lists the standard library headers and some constraints on those headers. [compliance] lists requirements for a freestanding implementation of the C++ standard library.
The C++ standard library provides definitions for the following types of entities: macros, values, types, templates, classes, functions, objects.
All library entities except macros, operator new and operator delete are defined within the namespace std or namespaces nested within namespace std.173 It is unspecified whether names declared in a specific namespace are declared directly in that namespace or in an inline namespace inside that namespace.174
Whenever a name x defined in the standard library is mentioned, the name x is assumed to be fully qualified as ::std::x, unless explicitly described otherwise. For example, if the Effects section for library function F is described as calling library function G, the function ::std::G is meant.
The C standard library headers (Annex [depr.c.headers]) also define names within the global namespace, while the C++ headers for C library facilities ([headers]) may also define names within the global namespace.
This gives implementers freedom to use inline namespaces to support multiple configurations of the library.
The facilities of the C standard Library are provided in 26 additional headers, as shown in Table [tab:cpp.c.headers].
Except as noted in Clauses [language.support] through [thread] and Annex [depr], the contents of each header cname shall be the same as that of the corresponding header name.h, as specified in the C standard library ([intro.refs]) or the C Unicode TR, as appropriate, as if by inclusion. In the C++ standard library, however, the declarations (except for names which are defined as macros in C) are within namespace scope ([basic.scope.namespace]) of the namespace std. It is unspecified whether these names are first declared within the global namespace scope and are then injected into namespace std by explicit using-declarations ([namespace.udecl]).
Names which are defined as macros in C shall be defined as macros in the C++ standard library, even if C grants license for implementation as functions. [ Note: The names defined as macros in C include the following: assert, offsetof, setjmp, va_arg, va_end, and va_start. — end note ]
Names that are defined as functions in C shall be defined as functions in the C++ standard library.176
Identifiers that are keywords or operators in C++ shall not be defined as macros in C++ standard library headers.177
A header is not necessarily a source file, nor are the sequences delimited by < and > in header names necessarily valid source file names ([cpp.include]).
This disallows the practice, allowed in C, of providing a masking macro in addition to the function prototype. The only way to achieve equivalent inline behavior in C++ is to provide a definition as an extern inline function.
In particular, including the standard header <iso646.h> or <ciso646> has no effect.
The ".h" headers dump all their names into the global namespace, whereas the newer forms keep their names in namespace std. Therefore, the newer forms are the preferred forms for all uses except for C++ programs which are intended to be strictly compatible with C.
A freestanding implementation has an implementation-defined set of headers. This set shall include at least the headers shown in Table [tab:cpp.headers.freestanding].
|[support.limits]||Implementation properties||<cfloat> <limits> <climits>|
|[support.start.term]||Start and termination||<cstdlib>|
|[support.dynamic]||Dynamic memory management||<new>|
|[support.runtime]||Other runtime support||<cstdalign> <cstdarg> <cstdbool>|