[description] # 16 Library introduction [[library]](./#library) ## 16.3 Method of description [description] ### [16.3.1](#general) General [[description.general]](description.general) [1](#general-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L181) Subclause [description] describes the conventions used to specify the C++ standard library[.](#general-1.sentence-1) [[structure]](#structure "16.3.2 Structure of each clause") describes the structure of[[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and[[depr]](depr "Annex D (normative) Compatibility features")[.](#general-1.sentence-2) [[conventions]](#conventions "16.3.3 Other conventions") describes other editorial conventions[.](#general-1.sentence-3) ### [16.3.2](#structure) Structure of each clause [[structure]](structure) #### [16.3.2.1](#structure.elements) Elements [[structure.elements]](structure.elements) [1](#structure.elements-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L191) Each library clause contains the following elements, as applicable:[132](#footnote-132 "To save space, items that do not apply to a Clause are omitted. For example, if a Clause does not specify any requirements, there will be no “Requirements” subclause.") - [(1.1)](#structure.elements-1.1) Summary - [(1.2)](#structure.elements-1.2) Requirements - [(1.3)](#structure.elements-1.3) Detailed specifications - [(1.4)](#structure.elements-1.4) References to the C standard library [132)](#footnote-132)[132)](#footnoteref-132) To save space, items that do not apply to a Clause are omitted[.](#footnote-132.sentence-1) For example, if a Clause does not specify any requirements, there will be no “Requirements” subclause[.](#footnote-132.sentence-2) #### [16.3.2.2](#structure.summary) Summary [[structure.summary]](structure.summary) [1](#structure.summary-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L208) The Summary provides a synopsis of the category, and introduces the first-level subclauses[.](#structure.summary-1.sentence-1) Each subclause also provides a summary, listing the headers specified in the subclause and the library entities provided in each header[.](#structure.summary-1.sentence-2) [2](#structure.summary-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L213) The contents of the summary and the detailed specifications include: - [(2.1)](#structure.summary-2.1) macros - [(2.2)](#structure.summary-2.2) values - [(2.3)](#structure.summary-2.3) types and alias templates - [(2.4)](#structure.summary-2.4) classes and class templates - [(2.5)](#structure.summary-2.5) functions and function templates - [(2.6)](#structure.summary-2.6) objects and variable templates - [(2.7)](#structure.summary-2.7) concepts #### [16.3.2.3](#structure.requirements) Requirements [[structure.requirements]](structure.requirements) [1](#structure.requirements-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L227) Requirements describe constraints that shall be met by a C++ program that extends the standard library[.](#structure.requirements-1.sentence-1) Such extensions are generally one of the following: - [(1.1)](#structure.requirements-1.1) Template arguments - [(1.2)](#structure.requirements-1.2) Derived classes - [(1.3)](#structure.requirements-1.3) Containers, iterators, and algorithms that meet an interface convention or model a concept [2](#structure.requirements-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L238) The string and iostream components use an explicit representation of operations required of template arguments[.](#structure.requirements-2.sentence-1) They use a class template char_traits to define these constraints[.](#structure.requirements-2.sentence-2) [3](#structure.requirements-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L243) Interface convention requirements are stated as generally as possible[.](#structure.requirements-3.sentence-1) Instead of stating “class X has to define a member function operator++()”, the interface requires “for any object x of class X, ++x is defined”[.](#structure.requirements-3.sentence-2) That is, whether the operator is a member is unspecified[.](#structure.requirements-3.sentence-3) [4](#structure.requirements-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L249) Requirements are stated in terms of well-defined expressions that define valid terms of the types that meet the requirements[.](#structure.requirements-4.sentence-1) For every set of well-defined expression requirements there is either a named concept or a table that specifies an initial set of the valid expressions and their semantics[.](#structure.requirements-4.sentence-2) Any generic algorithm ([[algorithms]](algorithms "26 Algorithms library")) that uses the well-defined expression requirements is described in terms of the valid expressions for its template type parameters[.](#structure.requirements-4.sentence-3) [5](#structure.requirements-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L257) The library specification uses a typographical convention for naming requirements[.](#structure.requirements-5.sentence-1) Names in *italic* type that begin with the prefix*Cpp17* refer to sets of well-defined expression requirements typically presented in tabular form, possibly with additional prose semantic requirements[.](#structure.requirements-5.sentence-2) For example, *Cpp17Destructible* (Table [35](utility.arg.requirements#tab:cpp17.destructible "Table 35: Cpp17Destructible requirements")) is such a named requirement[.](#structure.requirements-5.sentence-3) Names in constant width type refer to library concepts which are presented as a concept definition ([[temp]](temp "13 Templates")), possibly with additional prose semantic requirements[.](#structure.requirements-5.sentence-4) For example,[destructible](concept.destructible#concept:destructible "18.4.10 Concept destructible [concept.destructible]") ([[concept.destructible]](concept.destructible "18.4.10 Concept destructible")) is such a named requirement[.](#structure.requirements-5.sentence-5) [6](#structure.requirements-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L269) Template argument requirements are sometimes referenced by name[.](#structure.requirements-6.sentence-1) See [[type.descriptions]](#type.descriptions "16.3.3.3 Type descriptions")[.](#structure.requirements-6.sentence-2) [7](#structure.requirements-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L273) In some cases the semantic requirements are presented as C++ code[.](#structure.requirements-7.sentence-1) Such code is intended as a specification of equivalence of a construct to another construct, not necessarily as the way the construct must be implemented[.](#structure.requirements-7.sentence-2)[133](#footnote-133 "Although in some cases the code given is unambiguously the optimum implementation.") [8](#structure.requirements-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L284) Required operations of any concept defined in this document need not be total functions; that is, some arguments to a required operation may result in the required semantics failing to be met[.](#structure.requirements-8.sentence-1) [*Example [1](#structure.requirements-example-1)*: The required < operator of the [totally_ordered](concept.totallyordered#concept:totally_ordered "18.5.5 Concept totally_­ordered [concept.totallyordered]") concept ([[concept.totallyordered]](concept.totallyordered "18.5.5 Concept totally_­ordered")) does not meet the semantic requirements of that concept when operating on NaNs[.](#structure.requirements-8.sentence-2) — *end example*] This does not affect whether a type models the concept[.](#structure.requirements-8.sentence-3) [9](#structure.requirements-9) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L295) A declaration may explicitly impose requirements through its associated constraints ([[temp.constr.decl]](temp.constr.decl "13.5.3 Constrained declarations"))[.](#structure.requirements-9.sentence-1) When the associated constraints refer to a concept ([[temp.concept]](temp.concept "13.7.9 Concept definitions")), the semantic constraints specified for that concept are additionally imposed on the use of the declaration[.](#structure.requirements-9.sentence-2) [133)](#footnote-133)[133)](#footnoteref-133) Although in some cases the code given is unambiguously the optimum implementation[.](#footnote-133.sentence-1) #### [16.3.2.4](#structure.specifications) Detailed specifications [[structure.specifications]](structure.specifications) [1](#structure.specifications-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L303) The detailed specifications each contain the following elements: - [(1.1)](#structure.specifications-1.1) name and brief description - [(1.2)](#structure.specifications-1.2) synopsis (class definition or function declaration, as appropriate) - [(1.3)](#structure.specifications-1.3) restrictions on template arguments, if any - [(1.4)](#structure.specifications-1.4) description of class invariants - [(1.5)](#structure.specifications-1.5) description of function semantics [2](#structure.specifications-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L313) Descriptions of class member functions follow the order (as appropriate):[134](#footnote-134 "To save space, items that do not apply to a class are omitted. For example, if a class does not specify any comparison operator functions, there will be no “Comparison operator functions” subclause.") - [(2.1)](#structure.specifications-2.1) constructor(s) and destructor - [(2.2)](#structure.specifications-2.2) copying, moving & assignment functions - [(2.3)](#structure.specifications-2.3) comparison operator functions - [(2.4)](#structure.specifications-2.4) modifier functions - [(2.5)](#structure.specifications-2.5) observer functions - [(2.6)](#structure.specifications-2.6) operators and other non-member functions [3](#structure.specifications-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L330) Descriptions of function semantics contain the following elements (as appropriate):[135](#footnote-135 "To save space, elements that do not apply to a function are omitted. For example, if a function specifies no preconditions, there will be no Preconditions: element.") - [(3.1)](#structure.specifications-3.1) *Constraints*: the conditions for the function's participation in overload resolution ([[over.match]](over.match "12.2 Overload resolution"))[.](#structure.specifications-3.1.sentence-1) [*Note [1](#structure.specifications-note-1)*: Failure to meet such a condition results in the function's silent non-viability[.](#structure.specifications-3.1.sentence-2) — *end note*] [*Example [1](#structure.specifications-example-1)*: An implementation can express such a condition via a [*constraint-expression*](temp.constr.decl#nt:constraint-expression "13.5.3 Constrained declarations [temp.constr.decl]") ([[temp.constr.decl]](temp.constr.decl "13.5.3 Constrained declarations"))[.](#structure.specifications-3.1.sentence-3) — *end example*] - [(3.2)](#structure.specifications-3.2) *Mandates*: the conditions that, if not met, render the program ill-formed[.](#structure.specifications-3.2.sentence-1) [*Example [2](#structure.specifications-example-2)*: An implementation can express such a condition via the [*constant-expression*](expr.const#nt:constant-expression "7.7 Constant expressions [expr.const]") in a [*static_assert-declaration*](dcl.pre#nt:static_assert-declaration "9.1 Preamble [dcl.pre]") ([[dcl.pre]](dcl.pre "9.1 Preamble"))[.](#structure.specifications-3.2.sentence-2) If the diagnostic is to be emitted only after the function has been selected by overload resolution, an implementation can express such a condition via a [*constraint-expression*](temp.constr.decl#nt:constraint-expression "13.5.3 Constrained declarations [temp.constr.decl]") ([[temp.constr.decl]](temp.constr.decl "13.5.3 Constrained declarations")) and also define the function as deleted[.](#structure.specifications-3.2.sentence-3) — *end example*] - [(3.3)](#structure.specifications-3.3) *Constant When*: the conditions that are required for a call to the function to be a constant subexpression ([[defns.const.subexpr]](defns.const.subexpr "3.15 constant subexpression"))[.](#structure.specifications-3.3.sentence-1) - [(3.4)](#structure.specifications-3.4) *Preconditions*: conditions that the function assumes to hold whenever it is called; violation of any preconditions results in undefined behavior[.](#structure.specifications-3.4.sentence-1) [*Example [3](#structure.specifications-example-3)*: An implementation can express some such conditions via the use of a contract assertion, such as a precondition assertion ([[dcl.contract.func]](dcl.contract.func "9.4.1 General"))[.](#structure.specifications-3.4.sentence-2) — *end example*] - [(3.5)](#structure.specifications-3.5) *Hardened preconditions*: conditions that the function assumes to hold whenever it is called[.](#structure.specifications-3.5.sentence-1) * [(3.5.1)](#structure.specifications-3.5.1) When invoking the function in a hardened implementation, prior to any other observable side effects of the function, one or more contract assertions whose predicates are as described in the hardened precondition are evaluated with a checking semantic ([[basic.contract.eval]](basic.contract.eval "6.11.2 Evaluation"))[.](#structure.specifications-3.5.1.sentence-1) If any of these assertions is evaluated with a non-terminating semantic and the contract-violation handler returns, the program has undefined behavior[.](#structure.specifications-3.5.1.sentence-2) * [(3.5.2)](#structure.specifications-3.5.2) When invoking the function in a non-hardened implementation, if any hardened precondition is violated, the program has undefined behavior[.](#structure.specifications-3.5.2.sentence-1) - [(3.6)](#structure.specifications-3.6) *Effects*: the actions performed by the function[.](#structure.specifications-3.6.sentence-1) - [(3.7)](#structure.specifications-3.7) *Synchronization*: the synchronization operations ([[intro.multithread]](intro.multithread "6.10.2 Multi-threaded executions and data races")) applicable to the function[.](#structure.specifications-3.7.sentence-1) - [(3.8)](#structure.specifications-3.8) *Postconditions*: the conditions (sometimes termed observable results) established by the function[.](#structure.specifications-3.8.sentence-1) [*Example [4](#structure.specifications-example-4)*: An implementation can express some such conditions via the use of a contract assertion, such as a postcondition assertion ([[dcl.contract.func]](dcl.contract.func "9.4.1 General"))[.](#structure.specifications-3.8.sentence-2) — *end example*] - [(3.9)](#structure.specifications-3.9) *Result*: for a [*typename-specifier*](temp.res.general#nt:typename-specifier "13.8.1 General [temp.res.general]"), a description of the named type; for an [*expression*](expr.comma#nt:expression "7.6.20 Comma operator [expr.comma]"), a description of the type and value category of the expression; the expression is an lvalue if the type is an lvalue reference type, an xvalue if the type is an rvalue reference type, and a prvalue otherwise[.](#structure.specifications-3.9.sentence-1) - [(3.10)](#structure.specifications-3.10) *Returns*: a description of the value(s) returned by the function[.](#structure.specifications-3.10.sentence-1) - [(3.11)](#structure.specifications-3.11) *Throws*: any exceptions thrown by the function, and the conditions that would cause the exception[.](#structure.specifications-3.11.sentence-1) - [(3.12)](#structure.specifications-3.12) *Complexity*: the time and/or space complexity of the function[.](#structure.specifications-3.12.sentence-1) - [(3.13)](#structure.specifications-3.13) *Remarks*: additional semantic constraints on the function[.](#structure.specifications-3.13.sentence-1) - [(3.14)](#structure.specifications-3.14) *Error conditions*: the error conditions for error codes reported by the function[.](#structure.specifications-3.14.sentence-1) [4](#structure.specifications-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L447) Whenever the *Effects* element specifies that the semantics of some functionF are [*Equivalent to*](#def:Equivalent_to) some code sequence, then the various elements are interpreted as follows[.](#structure.specifications-4.sentence-1) If F's semantics specifies any *Constraints* or *Mandates* elements, then those requirements are logically imposed prior to the [*equivalent-to*](#def:equivalent-to) semantics[.](#structure.specifications-4.sentence-2) Next, the semantics of the code sequence are determined by the*Constraints*,*Mandates*,*Constant When*,*Preconditions*,*Hardened preconditions*,*Effects*,*Synchronization*,*Postconditions*,*Returns*,*Throws*,*Complexity*,*Remarks*, and*Error conditions* specified for the function invocations contained in the code sequence[.](#structure.specifications-4.sentence-3) The value returned from F is specified by F's *Returns* element, or if F has no *Returns* element, a non-void return from F is specified by thereturn statements ([[stmt.return]](stmt.return "8.8.4 The return statement")) in the code sequence[.](#structure.specifications-4.sentence-4) If F's semantics contains a *Throws*,*Postconditions*, or *Complexity* element, then that supersedes any occurrences of that element in the code sequence[.](#structure.specifications-4.sentence-5) [5](#structure.specifications-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L476) For non-reserved replacement and handler functions,[[support]](support "17 Language support library") specifies two behaviors for the functions in question: their required and default behavior[.](#structure.specifications-5.sentence-1) The [*default behavior*](#def:behavior,default "16.3.2.4 Detailed specifications [structure.specifications]") describes a function definition provided by the implementation[.](#structure.specifications-5.sentence-2) The [*required behavior*](#def:behavior,required "16.3.2.4 Detailed specifications [structure.specifications]") describes the semantics of a function definition provided by either the implementation or a C++ program[.](#structure.specifications-5.sentence-3) Where no distinction is explicitly made in the description, the behavior described is the required behavior[.](#structure.specifications-5.sentence-4) [6](#structure.specifications-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L488) If the formulation of a complexity requirement calls for a negative number of operations, the actual requirement is zero operations[.](#structure.specifications-6.sentence-1)[136](#footnote-136 "This simplifies the presentation of complexity requirements in some cases.") [7](#structure.specifications-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L496) Complexity requirements specified in the library clauses are upper bounds, and implementations that provide better complexity guarantees meet the requirements[.](#structure.specifications-7.sentence-1) [8](#structure.specifications-8) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L501) Error conditions specify conditions where a function may fail[.](#structure.specifications-8.sentence-1) The conditions are listed, together with a suitable explanation, as the enum class errc constants ([[syserr]](syserr "19.5 System error support"))[.](#structure.specifications-8.sentence-2) [134)](#footnote-134)[134)](#footnoteref-134) To save space, items that do not apply to a class are omitted[.](#footnote-134.sentence-1) For example, if a class does not specify any comparison operator functions, there will be no “Comparison operator functions” subclause[.](#footnote-134.sentence-2) [135)](#footnote-135)[135)](#footnoteref-135) To save space, elements that do not apply to a function are omitted[.](#footnote-135.sentence-1) For example, if a function specifies no preconditions, there will be no *Preconditions*: element[.](#footnote-135.sentence-2) [136)](#footnote-136)[136)](#footnoteref-136) This simplifies the presentation of complexity requirements in some cases[.](#footnote-136.sentence-1) #### [16.3.2.5](#structure.see.also) C library [[structure.see.also]](structure.see.also) [1](#structure.see.also-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L508) Paragraphs labeled “See also” contain cross-references to the relevant portions of other standards ([[intro.refs]](intro.refs "2 Normative references"))[.](#structure.see.also-1.sentence-1) ### [16.3.3](#conventions) Other conventions [[conventions]](conventions) #### [16.3.3.1](#conventions.general) General [[conventions.general]](conventions.general) [1](#conventions.general-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L517) Subclause [[conventions]](#conventions "16.3.3 Other conventions") describes several editorial conventions used to describe the contents of the C++ standard library[.](#conventions.general-1.sentence-1) These conventions are for describing[implementation-defined types](#type.descriptions "16.3.3.3 Type descriptions [type.descriptions]"), and [member functions](#functions.within.classes "16.3.3.5 Functions within classes [functions.within.classes]")[.](#conventions.general-1.sentence-2) #### [16.3.3.2](#expos.only.entity) Exposition-only entities, etc. [[expos.only.entity]](expos.only.entity) [1](#expos.only.entity-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L526) Several entities and [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]")*s* defined in [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features") are only defined for the purpose of exposition[.](#expos.only.entity-1.sentence-1) The declaration of such an entity or [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]") is followed by a comment ending in *exposition only*[.](#expos.only.entity-1.sentence-2) [2](#expos.only.entity-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L533) The following are defined for exposition only to aid in the specification of the library: [🔗](#lib:decay-copy) namespace std {templaterequires [convertible_to](concept.convertible#concept:convertible_to "18.4.4 Concept convertible_­to [concept.convertible]")>constexpr decay_t *decay-copy*(T&& v) // *exposition only*noexcept(is_nothrow_convertible_v>){ return std::forward(v); }constexpr auto *synth-three-way* = // *exposition only*[](const T& t, const U& u)requires requires {{ t < u } -> [*boolean-testable*](concept.booleantestable#concept:boolean-testable "18.5.2 Boolean testability [concept.booleantestable]"); { u < t } -> [*boolean-testable*](concept.booleantestable#concept:boolean-testable "18.5.2 Boolean testability [concept.booleantestable]"); }{if constexpr ([three_way_comparable_with](cmp.concept#concept:three_way_comparable_with "17.12.4 Concept three_­way_­comparable [cmp.concept]")) {return t <=> u; } else {if (t < u) return weak_ordering::less; if (u < t) return weak_ordering::greater; return weak_ordering::equivalent; }}; templateusing *synth-three-way-result* = // *exposition only*decltype(*synth-three-way*(declval(), declval()));} [3](#expos.only.entity-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L567) An object dst is said to be [*decay-copied from*](#def:decay-copied_from "16.3.3.2 Exposition-only entities, etc. [expos.only.entity]") a subexpression src if the type of dst isdecay_t #### [16.3.3.3](#type.descriptions) Type descriptions [[type.descriptions]](type.descriptions) #### [16.3.3.3.1](#type.descriptions.general) General [[type.descriptions.general]](type.descriptions.general) [1](#type.descriptions.general-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L579) The Requirements subclauses may describe names that are used to specify constraints on template arguments[.](#type.descriptions.general-1.sentence-1)[137](#footnote-137 "Examples from [utility.requirements] include: Cpp17EqualityComparable, Cpp17LessThanComparable, Cpp17CopyConstructible. Examples from [iterator.requirements] include: Cpp17InputIterator, Cpp17ForwardIterator.") These names are used in library Clauses to describe the types that may be supplied as arguments by a C++ program when instantiating template components from the library[.](#type.descriptions.general-1.sentence-2) [2](#type.descriptions.general-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L597) Certain types defined in [[input.output]](input.output "31 Input/output library") are used to describe implementation-defined types[.](#type.descriptions.general-2.sentence-1) They are based on other types, but with added constraints[.](#type.descriptions.general-2.sentence-2) [137)](#footnote-137)[137)](#footnoteref-137) Examples from [[utility.requirements]](utility.requirements "16.4.4 Requirements on types and expressions") include:*Cpp17EqualityComparable*,*Cpp17LessThanComparable*,*Cpp17CopyConstructible*[.](#footnote-137.sentence-1) Examples from [[iterator.requirements]](iterator.requirements "24.3 Iterator requirements") include:*Cpp17InputIterator*,*Cpp17ForwardIterator*[.](#footnote-137.sentence-2) #### [16.3.3.3.2](#enumerated.types) Enumerated types [[enumerated.types]](enumerated.types) [1](#enumerated.types-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L604) Several types defined in [[input.output]](input.output "31 Input/output library") are[*enumerated types*](#def:type,enumerated "16.3.3.3.2 Enumerated types [enumerated.types]")[.](#enumerated.types-1.sentence-1) Each enumerated type may be implemented as an enumeration or as a synonym for an enumeration[.](#enumerated.types-1.sentence-2)[138](#footnote-138 "Such as an integer type, with constant integer values ([basic.fundamental]).") [2](#enumerated.types-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L614) The enumerated type *enumerated* can be written:enum *enumerated* { V0, V1, V2, V3, … }; inline const enumerated C0(V0);inline const enumerated C1(V1);inline const enumerated C2(V2);inline const enumerated C3(V3); ⋮ [3](#enumerated.types-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L626) Here, the names C0,C1, etc. represent[*enumerated elements*](#def:enumerated_element "16.3.3.3.2 Enumerated types [enumerated.types]") for this particular enumerated type[.](#enumerated.types-3.sentence-1) All such elements have distinct values[.](#enumerated.types-3.sentence-2) [138)](#footnote-138)[138)](#footnoteref-138) Such as an integer type, with constant integer values ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types"))[.](#footnote-138.sentence-1) #### [16.3.3.3.3](#bitmask.types) Bitmask types [[bitmask.types]](bitmask.types) [1](#bitmask.types-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L636) Several types defined in [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features") are[*bitmask types*](#def:type,bitmask "16.3.3.3.3 Bitmask types [bitmask.types]")[.](#bitmask.types-1.sentence-1) Each bitmask type can be implemented as an enumerated type that overloads certain operators, as an integer type, or as a[bitset](template.bitset "22.9.2 Class template bitset [template.bitset]")[.](#bitmask.types-1.sentence-2) [2](#bitmask.types-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L646) The bitmask type *bitmask* can be written:// For exposition only.// int_type is an integral type capable of representing all values of the bitmask type.enum *bitmask* : int_type {V0 = 1 << 0, V1 = 1 << 1, V2 = 1 << 2, V3 = 1 << 3, …}; inline constexpr bitmask C0(V0);inline constexpr bitmask C1(V1);inline constexpr bitmask C2(V2);inline constexpr bitmask C3(V3); ⋮ constexpr *bitmask* operator&(*bitmask* X, *bitmask* Y) {return static_cast<*bitmask*>(static_cast(X) & static_cast(Y));}constexpr *bitmask* operator|(*bitmask* X, *bitmask* Y) {return static_cast<*bitmask*>(static_cast(X) | static_cast(Y));}constexpr *bitmask* operator^(*bitmask* X, *bitmask* Y) {return static_cast<*bitmask*>(static_cast(X) ^ static_cast(Y));}constexpr *bitmask* operator~(*bitmask* X) {return static_cast<*bitmask*>(~static_cast(X));}*bitmask*& operator&=(*bitmask*& X, *bitmask* Y) { X = X & Y; return X;}*bitmask*& operator|=(*bitmask*& X, *bitmask* Y) { X = X | Y; return X;}*bitmask*& operator^=(*bitmask*& X, *bitmask* Y) { X = X ^ Y; return X;} [3](#bitmask.types-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L687) Here, the names C0,C1, etc. represent[*bitmask elements*](#def:bitmask,element "16.3.3.3.3 Bitmask types [bitmask.types]") for this particular bitmask type[.](#bitmask.types-3.sentence-1) All such elements have distinct, nonzero values such that, for any pair Ci and Cj where i ≠j, Ci & Ci is nonzero andCi & Cj is zero[.](#bitmask.types-3.sentence-2) Additionally, the value 0 is used to represent an [*empty bitmask*](#def:bitmask,empty "16.3.3.3.3 Bitmask types [bitmask.types]"), in which no bitmask elements are set[.](#bitmask.types-3.sentence-3) [4](#bitmask.types-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L699) The following terms apply to objects and values of bitmask types: - [(4.1)](#bitmask.types-4.1) To [*set*](#def:bitmask,value,set "16.3.3.3.3 Bitmask types [bitmask.types]") a value *Y* in an object *X* is to evaluate the expression *X* |= *Y*[.](#bitmask.types-4.1.sentence-1) - [(4.2)](#bitmask.types-4.2) To [*clear*](#def:bitmask,value,clear "16.3.3.3.3 Bitmask types [bitmask.types]") a value *Y* in an object*X* is to evaluate the expression *X* &= ~*Y*[.](#bitmask.types-4.2.sentence-1) - [(4.3)](#bitmask.types-4.3) The value *Y* [*is set*](#def:bitmask,value,is_set "16.3.3.3.3 Bitmask types [bitmask.types]") in the object*X* if the expression *X* & *Y* is nonzero[.](#bitmask.types-4.3.sentence-1) #### [16.3.3.3.4](#character.seq) Character sequences [[character.seq]](character.seq) #### [16.3.3.3.4.1](#character.seq.general) General [[character.seq.general]](character.seq.general) [1](#character.seq.general-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L720) The C standard library makes widespread useof characters and character sequences that follow a few uniform conventions: - [(1.1)](#character.seq.general-1.1) Properties specified as [*locale-specific*](#def:locale-specific "16.3.3.3.4.1 General [character.seq.general]") may change during program execution by a call to setlocale(int, const char*) ([[clocale.syn]](clocale.syn "28.3.5.1 Header synopsis")), or by a change to a locale object, as described in [[locales]](locales "28.3.3 Locales") and [[input.output]](input.output "31 Input/output library")[.](#character.seq.general-1.1.sentence-1) - [(1.2)](#character.seq.general-1.2) The [*execution character set*](#def:character_set,execution "16.3.3.3.4.1 General [character.seq.general]") and the [*execution wide-character set*](#def:wide-character_set,execution "16.3.3.3.4.1 General [character.seq.general]") are supersets of the basic literal character set ([[lex.charset]](lex.charset "5.3.1 Character sets"))[.](#character.seq.general-1.2.sentence-1) The encodings of the execution character sets and the sets of additional elements (if any) are locale-specific[.](#character.seq.general-1.2.sentence-2) Each element of the execution wide-character set is encoded as a single code unit representable by a value of type wchar_t[.](#character.seq.general-1.2.sentence-3) [*Note [1](#character.seq.general-note-1)*: The encodings of the execution character sets can be unrelated to any literal encoding[.](#character.seq.general-1.2.sentence-4) — *end note*] - [(1.3)](#character.seq.general-1.3) A [*letter*](#def:letter "16.3.3.3.4.1 General [character.seq.general]") is any of the 26 lowercase or 26uppercase letters in the basic character set[.](#character.seq.general-1.3.sentence-1) - [(1.4)](#character.seq.general-1.4) The[*decimal-point character*](#def:character,decimal-point "16.3.3.3.4.1 General [character.seq.general]") is the locale-specific (single-byte) character used by functions that convert between a (single-byte) character sequence and a value of one of the floating-point types[.](#character.seq.general-1.4.sentence-1) It is used in the character sequence to denote the beginning of a fractional part[.](#character.seq.general-1.4.sentence-2) It is represented in [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features") by a period,'.', which is also its value in the "C" locale[.](#character.seq.general-1.4.sentence-3) - [(1.5)](#character.seq.general-1.5) A[*character sequence*](#def:character_sequence "16.3.3.3.4.1 General [character.seq.general]") is an [array object](dcl.array "9.3.4.5 Arrays [dcl.array]") *A* that can be declared as*T A*[*N*], where *T* is any of the typeschar,unsigned char, orsigned char ([[basic.fundamental]](basic.fundamental "6.9.2 Fundamental types")), optionally qualified by any combination ofconst orvolatile[.](#character.seq.general-1.5.sentence-1) The initial elements of the array have defined contents up to and including an element determined by some predicate[.](#character.seq.general-1.5.sentence-2) A character sequence can be designated by a pointer value*S* that points to its first element[.](#character.seq.general-1.5.sentence-3) #### [16.3.3.3.4.2](#byte.strings) Byte strings [[byte.strings]](byte.strings) [1](#byte.strings-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L788) A [*null-terminated byte string*](#def:ntbs "16.3.3.3.4.2 Byte strings [byte.strings]"), or ntbs, is a character sequence whose highest-addressed element with defined content has the value zero (the [*terminating null character*](#def:character,terminating_null "16.3.3.3.4.2 Byte strings [byte.strings]")); no other element in the sequence has the value zero[.](#byte.strings-1.sentence-1)[139](#footnote-139 "Many of the objects manipulated by function signatures declared in are character sequences or ntbss. The size of some of these character sequences is limited by a length value, maintained separately from the character sequence.") [2](#byte.strings-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L803) The [*length of an ntbs*](#def:ntbs,length "16.3.3.3.4.2 Byte strings [byte.strings]") is the number of elements that precede the terminating null character[.](#byte.strings-2.sentence-1) An [*empty ntbs*](#def:ntbs,empty "16.3.3.3.4.2 Byte strings [byte.strings]") has a length of zero[.](#byte.strings-2.sentence-2) [3](#byte.strings-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L810) The [*value of an ntbs*](#def:ntbs,value "16.3.3.3.4.2 Byte strings [byte.strings]") is the sequence of values of the elements up to and including the terminating null character[.](#byte.strings-3.sentence-1) [4](#byte.strings-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L815) A [*static ntbs*](#def:ntbs,static "16.3.3.3.4.2 Byte strings [byte.strings]") is an ntbs with static storage duration[.](#byte.strings-4.sentence-1)[140](#footnote-140 "A string-literal, such as "abc", is a static ntbs.") [139)](#footnote-139)[139)](#footnoteref-139) Many of the objects manipulated by function signatures declared in[](cstring.syn#header:%3ccstring%3e "27.5.1 Header synopsis [cstring.syn]") are character sequences or ntbss[.](#footnote-139.sentence-1) The size of some of these character sequences is limited by a length value, maintained separately from the character sequence[.](#footnote-139.sentence-2) [140)](#footnote-140)[140)](#footnoteref-140) A [*string-literal*](lex.string#nt:string-literal "5.13.5 String literals [lex.string]"), such as"abc", is a static ntbs[.](#footnote-140.sentence-1) #### [16.3.3.3.4.3](#multibyte.strings) Multibyte strings [[multibyte.strings]](multibyte.strings) [1](#multibyte.strings-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L827) A [*multibyte character*](#def:character,multibyte "16.3.3.3.4.3 Multibyte strings [multibyte.strings]") is a sequence of one or more bytes representing the code unit sequence for an encoded character of the execution character set[.](#multibyte.strings-1.sentence-1) [2](#multibyte.strings-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L834) A [*null-terminated multibyte string*](#def:ntmbs "16.3.3.3.4.3 Multibyte strings [multibyte.strings]"), or ntmbs, is an ntbs that constitutes a sequence of valid multibyte characters, beginning and ending in the initial shift state[.](#multibyte.strings-2.sentence-1)[141](#footnote-141 "An ntbs that contains characters only from the basic literal character set is also an ntmbs. Each multibyte character then consists of a single byte.") [3](#multibyte.strings-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L847) A [*static ntmbs*](#def:ntmbs,static "16.3.3.3.4.3 Multibyte strings [multibyte.strings]") is an ntmbs with static storage duration[.](#multibyte.strings-3.sentence-1) [141)](#footnote-141)[141)](#footnoteref-141) An ntbs that contains characters only from the basic literal character set is also an ntmbs[.](#footnote-141.sentence-1) Each multibyte character then consists of a single byte[.](#footnote-141.sentence-2) #### [16.3.3.3.5](#customization.point.object) Customization Point Object types [[customization.point.object]](customization.point.object) [1](#customization.point.object-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L853) A [*customization point object*](#def:customization_point_object) is a function object ([[function.objects]](function.objects "22.10 Function objects")) with a literal class type that interacts with program-defined types while enforcing semantic requirements on that interaction[.](#customization.point.object-1.sentence-1) [2](#customization.point.object-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L858) The type of a customization point object, ignoring cv-qualifiers, shall model[semiregular](concepts.object#concept:semiregular "18.6 Object concepts [concepts.object]") ([[concepts.object]](concepts.object "18.6 Object concepts"))[.](#customization.point.object-2.sentence-1) [3](#customization.point.object-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L862) All instances of a specific customization point object type shall be equal ([[concepts.equality]](concepts.equality "18.2 Equality preservation"))[.](#customization.point.object-3.sentence-1) The effects of invoking different instances of a specific customization point object type on the same arguments are equivalent[.](#customization.point.object-3.sentence-2) [4](#customization.point.object-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L869) The type T of a customization point object, ignoring [*cv-qualifier*](dcl.decl.general#nt:cv-qualifier "9.3.1 General [dcl.decl.general]")*s*, shall model[invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]"),[invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]"),[invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]"), and[invocable](concept.invocable#concept:invocable "18.7.2 Concept invocable [concept.invocable]") ([[concept.invocable]](concept.invocable "18.7.2 Concept invocable")) when the types in Args... meet the requirements specified in that customization point object's definition[.](#customization.point.object-4.sentence-1) When the types of Args... do not meet the customization point object's requirements, T shall not have a function call operator that participates in overload resolution[.](#customization.point.object-4.sentence-2) [5](#customization.point.object-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L881) For a given customization point object o, let p be a variable initialized as if by auto p = o;[.](#customization.point.object-5.sentence-1) Then for any sequence of arguments args..., the following expressions have effects equivalent to o(args...): - [(5.1)](#customization.point.object-5.1) p(args...) - [(5.2)](#customization.point.object-5.2) as_const(p)(args...) - [(5.3)](#customization.point.object-5.3) std​::​move(p)(args...) - [(5.4)](#customization.point.object-5.4) std​::​move(as_const(p))(args...) #### [16.3.3.4](#alg.func.obj) Algorithm function objects [[alg.func.obj]](alg.func.obj) [1](#alg.func.obj-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L895) An [*algorithm function object*](#def:algorithm_function_object "16.3.3.4 Algorithm function objects [alg.func.obj]") is a customization point object ([[customization.point.object]](#customization.point.object "16.3.3.3.5 Customization Point Object types")) that is specified as one or more overloaded function templates[.](#alg.func.obj-1.sentence-1) The name of these function templates designates the corresponding algorithm function object[.](#alg.func.obj-1.sentence-2) [2](#alg.func.obj-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L902) For an algorithm function object o, let S be the corresponding set of function templates[.](#alg.func.obj-2.sentence-1) Then for any sequence of arguments args …,o(args …) is expression-equivalent tos(args …), where the result of name lookup for s is the overload set S[.](#alg.func.obj-2.sentence-2) [*Note [1](#alg.func.obj-note-1)*: Algorithm function objects are not found by argument-dependent name lookup ([[basic.lookup.argdep]](basic.lookup.argdep "6.5.4 Argument-dependent name lookup"))[.](#alg.func.obj-2.sentence-3) When found by unqualified name lookup ([[basic.lookup.unqual]](basic.lookup.unqual "6.5.3 Unqualified name lookup")) for the [*postfix-expression*](expr.post.general#nt:postfix-expression "7.6.1.1 General [expr.post.general]") in a function call ([[expr.call]](expr.call "7.6.1.3 Function call")), they inhibit argument-dependent name lookup[.](#alg.func.obj-2.sentence-4) [*Example [1](#alg.func.obj-example-1)*: void foo() {using namespace std::ranges; std::vector vec{1,2,3}; find(begin(vec), end(vec), 2); // #1} The function call expression at #1 invokes std​::​ranges​::​find, not std​::​find[.](#alg.func.obj-2.sentence-5) — *end example*] — *end note*] #### [16.3.3.5](#functions.within.classes) Functions within classes [[functions.within.classes]](functions.within.classes) [1](#functions.within.classes-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L930) For the sake of exposition, [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features") do not describe copy/move constructors, assignment operators, or (non-virtual) destructors with the same apparent semantics as those that can be generated by default ([[class.copy.ctor]](class.copy.ctor "11.4.5.3 Copy/move constructors"), [[class.copy.assign]](class.copy.assign "11.4.6 Copy/move assignment operator"), [[class.dtor]](class.dtor "11.4.7 Destructors"))[.](#functions.within.classes-1.sentence-1) It is unspecified whether the implementation provides explicit definitions for such member function signatures, or for virtual destructors that can be generated by default[.](#functions.within.classes-1.sentence-2) #### [16.3.3.6](#objects.within.classes) Private members [[objects.within.classes]](objects.within.classes) [1](#objects.within.classes-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L945) [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and[[depr]](depr "Annex D (normative) Compatibility features") do not specify the representation of classes, and intentionally omit specification of [class members](class.mem "11.4 Class members [class.mem]")[.](#objects.within.classes-1.sentence-1) An implementation may define static or non-static class members, or both, as needed to implement the semantics of the member functions specified in [[support]](support "17 Language support library") through [[exec]](exec "33 Execution control library") and [[depr]](depr "Annex D (normative) Compatibility features")[.](#objects.within.classes-1.sentence-2) [2](#objects.within.classes-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L953) For the sake of exposition, some subclauses provide representative declarations, and semantic requirements, for private members of classes that meet the external specifications of the classes[.](#objects.within.classes-2.sentence-1) The declarations for such members are followed by a comment that ends with *exposition only*, as in:streambuf* sb; // *exposition only* [3](#objects.within.classes-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L963) An implementation may use any technique that provides equivalent observable behavior[.](#objects.within.classes-3.sentence-1) #### [16.3.3.7](#freestanding.item) Freestanding items [[freestanding.item]](freestanding.item) [1](#freestanding.item-1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L968) A [*freestanding item*](#def:freestanding_item "16.3.3.7 Freestanding items [freestanding.item]") is a declaration, entity, [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]"), or macro that is required to be present in a freestanding implementation and a hosted implementation[.](#freestanding.item-1.sentence-1) [2](#freestanding.item-2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L975) Unless otherwise specified, the requirements on freestanding items for a freestanding implementation are the same as the corresponding requirements for a hosted implementation, except that not all of the members of those items are required to be present[.](#freestanding.item-2.sentence-1) [3](#freestanding.item-3) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L981) Function declarations and function template declarations followed by a comment that include *freestanding-deleted* are[*freestanding deleted functions*](#def:function,freestanding_deleted "16.3.3.7 Freestanding items [freestanding.item]")[.](#freestanding.item-3.sentence-1) On freestanding implementations, it is implementation-defined whether each entity introduced by a freestanding deleted function is a deleted function ([[dcl.fct.def.delete]](dcl.fct.def.delete "9.6.3 Deleted definitions")) or whether the requirements are the same as the corresponding requirements for a hosted implementation[.](#freestanding.item-3.sentence-2) [*Note [1](#freestanding.item-note-1)*: Deleted definitions reduce the chance of overload resolution silently changing when migrating from a freestanding implementation to a hosted implementation[.](#freestanding.item-3.sentence-3) — *end note*] [*Example [1](#freestanding.item-example-1)*: double abs(double j); // freestanding-deleted — *end example*] [4](#freestanding.item-4) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1001) A declaration in a synopsis is a freestanding item if - [(4.1)](#freestanding.item-4.1) it is followed by a comment that includes *freestanding*, - [(4.2)](#freestanding.item-4.2) it is followed by a comment that includes *freestanding-deleted*, or - [(4.3)](#freestanding.item-4.3) the header synopsis begins with a comment that includes *freestanding* and the declaration is not followed by a comment that includes *hosted*[.](#freestanding.item-4.sentence-1) [*Note [2](#freestanding.item-note-2)*: Declarations followed by *hosted* in freestanding headers are not freestanding items[.](#freestanding.item-4.3.sentence-2) As a result, looking up the name of such functions can vary between hosted and freestanding implementations[.](#freestanding.item-4.3.sentence-3) — *end note*] [*Example [2](#freestanding.item-example-2)*: // all freestandingnamespace std { — *end example*] [5](#freestanding.item-5) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1024) An entity, deduction guide, or [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]") is a freestanding item if its introducing declaration is not followed by a comment that includes *hosted*, and is: - [(5.1)](#freestanding.item-5.1) introduced by a declaration that is a freestanding item, - [(5.2)](#freestanding.item-5.2) a member of a freestanding item other than a namespace, - [(5.3)](#freestanding.item-5.3) an enumerator of a freestanding item, - [(5.4)](#freestanding.item-5.4) a deduction guide of a freestanding item, - [(5.5)](#freestanding.item-5.5) an enclosing namespace of a freestanding item, - [(5.6)](#freestanding.item-5.6) a friend of a freestanding item, - [(5.7)](#freestanding.item-5.7) denoted by a [*typedef-name*](dcl.typedef#nt:typedef-name "9.2.4 The typedef specifier [dcl.typedef]") that is a freestanding item, or - [(5.8)](#freestanding.item-5.8) denoted by an alias template that is a freestanding item[.](#freestanding.item-5.sentence-1) [6](#freestanding.item-6) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1042) A macro is a freestanding item if it is defined in a header synopsis and - [(6.1)](#freestanding.item-6.1) the definition is followed by a comment that includes *freestanding*, or - [(6.2)](#freestanding.item-6.2) the header synopsis begins with a comment that includes *freestanding* and the definition is not followed by a comment that includes *hosted*[.](#freestanding.item-6.sentence-1) [*Example [3](#freestanding.item-example-3)*: #define NULL *see below* // freestanding — *end example*] [7](#freestanding.item-7) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/lib-intro.tex#L1058) [*Note [3](#freestanding.item-note-3)*: Freestanding annotations follow some additional exposition conventions that do not impose any additional normative requirements[.](#freestanding.item-7.sentence-1) Header synopses that begin with a comment containing "all freestanding" contain no hosted items and no freestanding deleted functions[.](#freestanding.item-7.sentence-2) Header synopses that begin with a comment containing "mostly freestanding" contain at least one hosted item or freestanding deleted function[.](#freestanding.item-7.sentence-3) Classes and class templates followed by a comment containing "partially freestanding" contain at least one hosted item or freestanding deleted function[.](#freestanding.item-7.sentence-4) — *end note*] [*Example [4](#freestanding.item-example-4)*: template struct array; // partially freestandingtemplatestruct array {constexpr reference operator[](size_type n); constexpr const_reference operator[](size_type n) const; constexpr reference at(size_type n); // freestanding-deletedconstexpr const_reference at(size_type n) const; // freestanding-deleted}; — *end example*]