44 lines
2.2 KiB
Markdown
44 lines
2.2 KiB
Markdown
[using.headers]
|
||
|
||
# 16 Library introduction [[library]](./#library)
|
||
|
||
## 16.4 Library-wide requirements [[requirements]](requirements#using.headers)
|
||
|
||
### 16.4.3 Using the library [[using]](using#headers)
|
||
|
||
#### 16.4.3.2 Headers [using.headers]
|
||
|
||
[1](#1)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1686)
|
||
|
||
The entities in the C++ standard library are defined in headers,
|
||
whose contents are made available to a translation unit when it contains the appropriate#include preprocessing directive ([[cpp.include]](cpp.include "15.3 Source file inclusion"))
|
||
or the appropriateimport declaration ([[module.import]](module.import "10.3 Import declaration"))[.](#1.sentence-1)
|
||
|
||
[2](#2)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1698)
|
||
|
||
A translation unit may include library headers in any order ([[lex.separate]](lex.separate "5.1 Separate translation"))[.](#2.sentence-1)
|
||
|
||
Each may be included more than once, with no effect different from
|
||
being included exactly once, except that the effect of including either[<cassert>](assertions.general#header:%3ccassert%3e "19.3.1 General [assertions.general]") or [<assert.h>](support.c.headers.general#header:%3cassert.h%3e "17.15.1 General [support.c.headers.general]") depends each time on the lexically current definition ofNDEBUG[.](#2.sentence-2)[149](#footnote-149 "This is the same as the C standard library.")
|
||
|
||
[3](#3)
|
||
|
||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1712)
|
||
|
||
A translation unit shall include a header only outside of anydeclaration or definition and,
|
||
in the case of a module unit,
|
||
only in its [*global-module-fragment*](module.global.frag#nt:global-module-fragment "10.4 Global module fragment [module.global.frag]"), and
|
||
shall include the header or import the corresponding header unit lexically
|
||
before the first reference in that translation unit to any of the entities
|
||
declared in that header[.](#3.sentence-1)
|
||
|
||
No diagnostic is required[.](#3.sentence-2)
|
||
|
||
[149)](#footnote-149)[149)](#footnoteref-149)
|
||
|
||
This is the same as the C standard library[.](#footnote-149.sentence-1)
|