[organization] (original) (raw)

16 Library introduction [library]

16.4 Library-wide requirements [requirements]

16.4.2 Library contents and organization [organization]


16.4.2.1 General [organization.general]

16.4.2.2 Library contents [contents]

16.4.2.3 Headers [headers]

16.4.2.4 Modules [std.modules]

16.4.2.5 Freestanding implementations [compliance]


16.4.2.1 General [organization.general]

[contents] describes the entities and macros 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.

16.4.2.2 Library contents [contents]

The C++ standard library provides definitions for the entities and macros described in the synopses of the C++ standard library headers ([headers]), unless otherwise specified.

All library entities exceptoperator newandoperator deleteare defined within the namespacestdor namespaces nested within namespacestd.142

It is unspecified whether names declared in a specific namespace are declared directly in that namespace or in an inline namespace inside that namespace.143

Whenever an unqualified name other thanswap, make_error_code, make_error_condition,from_stream, orsubmdspan_mappingis used in the specification of a declaration Din [support] through [exec] or [depr], its meaning is established as-if by performing unqualified name lookup ([basic.lookup.unqual]) in the context of D.

[Note 1:

Argument-dependent lookup is not performed.

— _end note_]

Similarly, the meaning of a qualified-id is established as-if by performing qualified name lookup ([basic.lookup.qual]) in the context of D.

[Example 1:

The reference to is_array_v in the specification of std​::​to_array ([array.creation]) refers to ​::​std​::​is_array_v.

— _end example_]

The meaning of the unqualified name swap is established in an overload resolution context for swappable values ([swappable.requirements]).

The meanings of the unqualified namesmake_error_code, make_error_condition,from_stream, andsubmdspan_mappingare established as-if by performing argument-dependent lookup ([basic.lookup.argdep]).

16.4.2.4 Modules [std.modules]

The C++ standard library provides the following C++ library modules.

The named module std exports declarations in namespace stdthat are provided by the importable C++ library headers (Table 24 or the subset provided by a freestanding implementation) and the C++ headers for C library facilities (Table 25).

It additionally exports declarations in the global namespace for the storage allocation and deallocation functions that are provided by .

The named module std.compat exports the same declarations as the named module std, and additionally exports

It is unspecified to which module a declaration in the standard library is attached.

[Note 1:

Conforming implementations ensure that mixing#include and import does not result in conflicting attachments ([basic.link]).

— _end note_]

Recommended practice: Implementations should ensure such attachments do not preclude further evolution or decomposition of the standard library modules.

A declaration in the standard library denotes the same entity regardless of whether it was made reachable through including a header, importing a header unit, or importing a C++ library module.

Recommended practice: Implementations should avoid exporting any other declarations from the C++ library modules.

16.4.2.5 Freestanding implementations [compliance]

Two kinds of implementations are defined:hosted and freestanding ([intro.compliance]); the kind of the implementation isimplementation-defined.

For a hosted implementation, this document describes the set of available headers.

A freestanding implementation has animplementation-defined set of headers.

This set shall include at least the headers shown in Table 27.

For each of the headers listed in Table 27, a freestanding implementation provides at least the freestanding items ([freestanding.item]) declared in the header.

The hosted library facilities are the set of facilities described in this document that are required for hosted implementations, but not required for freestanding implementations.

A freestanding implementation provides a (possibly empty) implementation-defined subset of the hosted library facilities.

Unless otherwise specified, the requirements on each declaration, entity, and macro provided in this way are the same as the corresponding requirements for a hosted implementation, except that not all of the members of the namespaces are required to be present.

A freestanding implementation provides deleted definitions ([dcl.fct.def.delete]) for a (possibly empty) implementation-defined subset of the namespace-scope functions and function templates from the hosted library facilities.

[Note 1:

An implementation can provide a deleted definition so that the result of overload resolution does not silently change when migrating a program from a freestanding implementation to a hosted implementation.

— _end note_]