5.6 KiB
[freestanding.item]
16 Library introduction [library]
16.3 Method of description [description]
16.3.3 Other conventions [conventions]
16.3.3.7 Freestanding items [freestanding.item]
A freestanding item is a declaration, entity, typedef-name, or macro that is required to be present in a freestanding implementation and a hosted implementation.
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.
Function declarations and function template declarations followed by a comment that include freestanding-deleted arefreestanding deleted functions.
On freestanding implementations, it is implementation-defined whether each entity introduced by a freestanding deleted function is a deleted function ([dcl.fct.def.delete]) or whether the requirements are the same as the corresponding requirements for a hosted implementation.
[Note 1:
Deleted definitions reduce the chance of overload resolution silently changing when migrating from a freestanding implementation to a hosted implementation.
â end note]
[Example 1: double abs(double j); // freestanding-deleted â end example]
A declaration in a synopsis is a freestanding item if
it is followed by a comment that includes freestanding,
it is followed by a comment that includes freestanding-deleted, or
the header synopsis begins with a comment that includes freestanding and the declaration is not followed by a comment that includes hosted. [Note 2: Declarations followed by hosted in freestanding headers are not freestanding items. As a result, looking up the name of such functions can vary between hosted and freestanding implementations. â end note]
[Example 2: // all freestandingnamespace std { â end example]
An entity, deduction guide, or typedef-name is a freestanding item if its introducing declaration is not followed by a comment that includes hosted, and is:
introduced by a declaration that is a freestanding item,
a member of a freestanding item other than a namespace,
an enumerator of a freestanding item,
a deduction guide of a freestanding item,
an enclosing namespace of a freestanding item,
a friend of a freestanding item,
denoted by a typedef-name that is a freestanding item, or
denoted by an alias template that is a freestanding item.
A macro is a freestanding item if it is defined in a header synopsis and
the definition is followed by a comment that includes freestanding, or
the header synopsis begins with a comment that includes freestanding and the definition is not followed by a comment that includes hosted.
[Example 3: #define NULL see below // freestanding â end example]
[Note 3:
Freestanding annotations follow some additional exposition conventions that do not impose any additional normative requirements.
Header synopses that begin with a comment containing "all freestanding" contain no hosted items and no freestanding deleted functions.
Header synopses that begin with a comment containing "mostly freestanding" contain at least one hosted item or freestanding deleted function.
Classes and class templates followed by a comment containing "partially freestanding" contain at least one hosted item or freestanding deleted function.
â end note]
[Example 4: template<class T, size_t N> struct array; // partially freestandingtemplate<class T, size_t N>struct 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]