tmp/tmpb20w0k9u/{from.md → to.md}
RENAMED
|
@@ -1,55 +1,104 @@
|
|
| 1 |
#### Freestanding items <a id="freestanding.item">[[freestanding.item]]</a>
|
| 2 |
|
| 3 |
-
A *freestanding item* is a declaration, entity,
|
| 4 |
-
|
| 5 |
-
|
| 6 |
|
| 7 |
Unless otherwise specified, the requirements on freestanding items for a
|
| 8 |
freestanding implementation are the same as the corresponding
|
| 9 |
requirements for a hosted implementation, except that not all of the
|
| 10 |
-
members of
|
| 11 |
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
- the header synopsis begins with a comment that includes *all
|
| 22 |
-
freestanding*.
|
| 23 |
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
- introduced by a declaration that is a freestanding item,
|
|
|
|
|
|
|
|
|
|
| 27 |
- an enclosing namespace of a freestanding item,
|
| 28 |
- a friend of a freestanding item,
|
| 29 |
-
- denoted by a
|
| 30 |
- denoted by an alias template that is a freestanding item.
|
| 31 |
|
| 32 |
A macro is a freestanding item if it is defined in a header synopsis and
|
| 33 |
|
| 34 |
- the definition is followed by a comment that includes *freestanding*,
|
| 35 |
or
|
| 36 |
-
- the header synopsis begins with a comment that includes *
|
| 37 |
-
|
|
|
|
| 38 |
|
| 39 |
-
[*Example
|
| 40 |
|
| 41 |
``` cpp
|
| 42 |
#define NULL see below // freestanding
|
| 43 |
```
|
| 44 |
|
| 45 |
— *end example*]
|
| 46 |
|
| 47 |
-
[*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
|
| 49 |
``` cpp
|
| 50 |
-
//
|
| 51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
```
|
| 53 |
|
| 54 |
— *end example*]
|
| 55 |
|
|
|
|
| 1 |
#### Freestanding items <a id="freestanding.item">[[freestanding.item]]</a>
|
| 2 |
|
| 3 |
+
A *freestanding item* is a declaration, entity, or macro that is
|
| 4 |
+
required to be present in a freestanding implementation and a hosted
|
| 5 |
+
implementation.
|
| 6 |
|
| 7 |
Unless otherwise specified, the requirements on freestanding items for a
|
| 8 |
freestanding implementation are the same as the corresponding
|
| 9 |
requirements for a hosted implementation, except that not all of the
|
| 10 |
+
members of those items are required to be present.
|
| 11 |
|
| 12 |
+
Function declarations and function template declarations followed by a
|
| 13 |
+
comment that include *freestanding-deleted* are *freestanding deleted
|
| 14 |
+
functions*. On freestanding implementations, it is
|
| 15 |
+
*implementation-defined* whether each entity introduced by a
|
| 16 |
+
freestanding deleted function is a deleted function
|
| 17 |
+
[[dcl.fct.def.delete]] or whether the requirements are the same as the
|
| 18 |
+
corresponding requirements for a hosted implementation.
|
| 19 |
|
| 20 |
+
[*Note 1*: Deleted definitions reduce the chance of overload resolution
|
| 21 |
+
silently changing when migrating from a freestanding implementation to a
|
| 22 |
+
hosted implementation. — *end note*]
|
| 23 |
|
| 24 |
+
[*Example 1*:
|
|
|
|
|
|
|
| 25 |
|
| 26 |
+
``` cpp
|
| 27 |
+
double abs(double j); // freestanding-deleted
|
| 28 |
+
```
|
| 29 |
+
|
| 30 |
+
— *end example*]
|
| 31 |
+
|
| 32 |
+
A declaration in a synopsis is a freestanding item if
|
| 33 |
+
|
| 34 |
+
- it is followed by a comment that includes *freestanding*,
|
| 35 |
+
- it is followed by a comment that includes *freestanding-deleted*, or
|
| 36 |
+
- the header synopsis begins with a comment that includes *freestanding*
|
| 37 |
+
and the declaration is not followed by a comment that includes
|
| 38 |
+
*hosted*. \[*Note 2*: Declarations followed by *hosted* in
|
| 39 |
+
freestanding headers are not freestanding items. As a result, looking
|
| 40 |
+
up the name of such functions can vary between hosted and freestanding
|
| 41 |
+
implementations. — *end note*]
|
| 42 |
+
|
| 43 |
+
[*Example 2*:
|
| 44 |
+
|
| 45 |
+
``` cpp
|
| 46 |
+
// all freestanding
|
| 47 |
+
namespace std {
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
— *end example*]
|
| 51 |
+
|
| 52 |
+
An entity or deduction guide is a freestanding item if its introducing
|
| 53 |
+
declaration is not followed by a comment that includes *hosted*, and is:
|
| 54 |
|
| 55 |
- introduced by a declaration that is a freestanding item,
|
| 56 |
+
- a member of a freestanding item other than a namespace,
|
| 57 |
+
- an enumerator of a freestanding item,
|
| 58 |
+
- a deduction guide of a freestanding item,
|
| 59 |
- an enclosing namespace of a freestanding item,
|
| 60 |
- a friend of a freestanding item,
|
| 61 |
+
- denoted by a type alias that is a freestanding item, or
|
| 62 |
- denoted by an alias template that is a freestanding item.
|
| 63 |
|
| 64 |
A macro is a freestanding item if it is defined in a header synopsis and
|
| 65 |
|
| 66 |
- the definition is followed by a comment that includes *freestanding*,
|
| 67 |
or
|
| 68 |
+
- the header synopsis begins with a comment that includes *freestanding*
|
| 69 |
+
and the definition is not followed by a comment that includes
|
| 70 |
+
*hosted*.
|
| 71 |
|
| 72 |
+
[*Example 3*:
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
#define NULL see below // freestanding
|
| 76 |
```
|
| 77 |
|
| 78 |
— *end example*]
|
| 79 |
|
| 80 |
+
[*Note 3*: Freestanding annotations follow some additional exposition
|
| 81 |
+
conventions that do not impose any additional normative requirements.
|
| 82 |
+
Header synopses that begin with a comment containing "all freestanding"
|
| 83 |
+
contain no hosted items and no freestanding deleted functions. Header
|
| 84 |
+
synopses that begin with a comment containing "mostly freestanding"
|
| 85 |
+
contain at least one hosted item or freestanding deleted function.
|
| 86 |
+
Classes and class templates followed by a comment containing "partially
|
| 87 |
+
freestanding" contain at least one hosted item or freestanding deleted
|
| 88 |
+
function. — *end note*]
|
| 89 |
+
|
| 90 |
+
[*Example 4*:
|
| 91 |
|
| 92 |
``` cpp
|
| 93 |
+
template<class T, size_t N> struct array; // partially freestanding
|
| 94 |
+
template<class T, size_t N>
|
| 95 |
+
struct array {
|
| 96 |
+
constexpr reference operator[](size_type n);
|
| 97 |
+
constexpr const_reference operator[](size_type n) const;
|
| 98 |
+
constexpr reference at(size_type n); // freestanding-deleted
|
| 99 |
+
constexpr const_reference at(size_type n) const; // freestanding-deleted
|
| 100 |
+
};
|
| 101 |
```
|
| 102 |
|
| 103 |
— *end example*]
|
| 104 |
|