tmp/tmpvzgssxha/{from.md → to.md}
RENAMED
|
@@ -4,14 +4,16 @@
|
|
| 4 |
|
| 5 |
The class `error_category` serves as a base class for types used to
|
| 6 |
identify the source and encoding of a particular category of error code.
|
| 7 |
Classes may be derived from `error_category` to support categories of
|
| 8 |
errors in addition to those defined in this International Standard. Such
|
| 9 |
-
classes shall behave as specified in this subclause.
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
| 13 |
|
| 14 |
``` cpp
|
| 15 |
namespace std {
|
| 16 |
class error_category {
|
| 17 |
public:
|
|
@@ -30,12 +32,11 @@ namespace std {
|
|
| 30 |
bool operator<(const error_category& rhs) const noexcept;
|
| 31 |
};
|
| 32 |
|
| 33 |
const error_category& generic_category() noexcept;
|
| 34 |
const error_category& system_category() noexcept;
|
| 35 |
-
|
| 36 |
-
} // namespace std
|
| 37 |
```
|
| 38 |
|
| 39 |
#### Class `error_category` virtual members <a id="syserr.errcat.virtuals">[[syserr.errcat.virtuals]]</a>
|
| 40 |
|
| 41 |
``` cpp
|
|
@@ -98,11 +99,12 @@ bool operator!=(const error_category& rhs) const noexcept;
|
|
| 98 |
bool operator<(const error_category& rhs) const noexcept;
|
| 99 |
```
|
| 100 |
|
| 101 |
*Returns:* `less<const error_category*>()(this, &rhs)`.
|
| 102 |
|
| 103 |
-
`less` ([[comparisons]]) provides a total ordering for
|
|
|
|
| 104 |
|
| 105 |
#### Program defined classes derived from `error_category` <a id="syserr.errcat.derived">[[syserr.errcat.derived]]</a>
|
| 106 |
|
| 107 |
``` cpp
|
| 108 |
virtual const char* name() const noexcept = 0;
|
|
@@ -160,10 +162,12 @@ function shall return a pointer to the string `"system"`. The object’s
|
|
| 160 |
|
| 161 |
If the argument `ev` corresponds to a POSIX `errno` value `posv`, the
|
| 162 |
function shall return `error_condition(posv, generic_category())`.
|
| 163 |
Otherwise, the function shall return
|
| 164 |
`error_condition(ev, system_category())`. What constitutes
|
| 165 |
-
correspondence for any given operating system is unspecified.
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
|
|
|
|
|
|
| 169 |
|
|
|
|
| 4 |
|
| 5 |
The class `error_category` serves as a base class for types used to
|
| 6 |
identify the source and encoding of a particular category of error code.
|
| 7 |
Classes may be derived from `error_category` to support categories of
|
| 8 |
errors in addition to those defined in this International Standard. Such
|
| 9 |
+
classes shall behave as specified in this subclause.
|
| 10 |
+
|
| 11 |
+
[*Note 1*: `error_category` objects are passed by reference, and two
|
| 12 |
+
such objects are equal if they have the same address. This means that
|
| 13 |
+
applications using custom `error_category` types should create a single
|
| 14 |
+
object of each such type. — *end note*]
|
| 15 |
|
| 16 |
``` cpp
|
| 17 |
namespace std {
|
| 18 |
class error_category {
|
| 19 |
public:
|
|
|
|
| 32 |
bool operator<(const error_category& rhs) const noexcept;
|
| 33 |
};
|
| 34 |
|
| 35 |
const error_category& generic_category() noexcept;
|
| 36 |
const error_category& system_category() noexcept;
|
| 37 |
+
}
|
|
|
|
| 38 |
```
|
| 39 |
|
| 40 |
#### Class `error_category` virtual members <a id="syserr.errcat.virtuals">[[syserr.errcat.virtuals]]</a>
|
| 41 |
|
| 42 |
``` cpp
|
|
|
|
| 99 |
bool operator<(const error_category& rhs) const noexcept;
|
| 100 |
```
|
| 101 |
|
| 102 |
*Returns:* `less<const error_category*>()(this, &rhs)`.
|
| 103 |
|
| 104 |
+
[*Note 1*: `less` ([[comparisons]]) provides a total ordering for
|
| 105 |
+
pointers. — *end note*]
|
| 106 |
|
| 107 |
#### Program defined classes derived from `error_category` <a id="syserr.errcat.derived">[[syserr.errcat.derived]]</a>
|
| 108 |
|
| 109 |
``` cpp
|
| 110 |
virtual const char* name() const noexcept = 0;
|
|
|
|
| 162 |
|
| 163 |
If the argument `ev` corresponds to a POSIX `errno` value `posv`, the
|
| 164 |
function shall return `error_condition(posv, generic_category())`.
|
| 165 |
Otherwise, the function shall return
|
| 166 |
`error_condition(ev, system_category())`. What constitutes
|
| 167 |
+
correspondence for any given operating system is unspecified.
|
| 168 |
+
|
| 169 |
+
[*Note 1*: The number of potential system error codes is large and
|
| 170 |
+
unbounded, and some may not correspond to any POSIX `errno` value. Thus
|
| 171 |
+
implementations are given latitude in determining
|
| 172 |
+
correspondence. — *end note*]
|
| 173 |
|