tmp/tmpzn9r9655/{from.md → to.md}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
### Class `error_code` <a id="syserr.errcode">[[syserr.errcode]]</a>
|
| 2 |
|
| 3 |
-
####
|
| 4 |
|
| 5 |
The class `error_code` describes an object used to hold error code
|
| 6 |
values, such as those originating from the operating system or other
|
| 7 |
low-level application program interfaces.
|
| 8 |
|
|
@@ -44,71 +44,59 @@ namespace std {
|
|
| 44 |
basic_ostream<charT, traits>&
|
| 45 |
operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
|
| 46 |
}
|
| 47 |
```
|
| 48 |
|
| 49 |
-
####
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
error_code() noexcept;
|
| 53 |
```
|
| 54 |
|
| 55 |
-
*
|
| 56 |
-
|
| 57 |
-
*Postconditions:* `val_ == 0` and `cat_ == &system_category()`.
|
| 58 |
|
| 59 |
``` cpp
|
| 60 |
error_code(int val, const error_category& cat) noexcept;
|
| 61 |
```
|
| 62 |
|
| 63 |
-
*
|
| 64 |
-
|
| 65 |
-
*Postconditions:* `val_ == val` and `cat_ == &cat`.
|
| 66 |
|
| 67 |
``` cpp
|
| 68 |
template<class ErrorCodeEnum>
|
| 69 |
error_code(ErrorCodeEnum e) noexcept;
|
| 70 |
```
|
| 71 |
|
| 72 |
-
*
|
| 73 |
|
| 74 |
-
*
|
| 75 |
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
This constructor shall not participate in overload resolution unless
|
| 79 |
-
`is_error_code_enum_v<ErrorCodeEnum>` is `true`.
|
| 80 |
-
|
| 81 |
-
#### Class `error_code` modifiers <a id="syserr.errcode.modifiers">[[syserr.errcode.modifiers]]</a>
|
| 82 |
|
| 83 |
``` cpp
|
| 84 |
void assign(int val, const error_category& cat) noexcept;
|
| 85 |
```
|
| 86 |
|
| 87 |
-
*
|
| 88 |
|
| 89 |
``` cpp
|
| 90 |
template<class ErrorCodeEnum>
|
| 91 |
error_code& operator=(ErrorCodeEnum e) noexcept;
|
| 92 |
```
|
| 93 |
|
| 94 |
-
*
|
|
|
|
|
|
|
| 95 |
|
| 96 |
*Returns:* `*this`.
|
| 97 |
|
| 98 |
-
*Remarks:*
|
| 99 |
-
|
| 100 |
-
This operator shall not participate in overload resolution unless
|
| 101 |
-
`is_error_code_enum_v<ErrorCodeEnum>` is `true`.
|
| 102 |
-
|
| 103 |
``` cpp
|
| 104 |
void clear() noexcept;
|
| 105 |
```
|
| 106 |
|
| 107 |
-
*
|
| 108 |
|
| 109 |
-
####
|
| 110 |
|
| 111 |
``` cpp
|
| 112 |
int value() const noexcept;
|
| 113 |
```
|
| 114 |
|
|
@@ -136,21 +124,21 @@ string message() const;
|
|
| 136 |
explicit operator bool() const noexcept;
|
| 137 |
```
|
| 138 |
|
| 139 |
*Returns:* `value() != 0`.
|
| 140 |
|
| 141 |
-
####
|
| 142 |
|
| 143 |
``` cpp
|
| 144 |
error_code make_error_code(errc e) noexcept;
|
| 145 |
```
|
| 146 |
|
| 147 |
*Returns:* `error_code(static_cast<int>(e), generic_category())`.
|
| 148 |
|
| 149 |
``` cpp
|
| 150 |
template<class charT, class traits>
|
| 151 |
-
basic_ostream<charT, traits>&
|
| 152 |
-
operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
|
| 153 |
```
|
| 154 |
|
| 155 |
-
*Effects:*
|
|
|
|
| 156 |
|
|
|
|
| 1 |
### Class `error_code` <a id="syserr.errcode">[[syserr.errcode]]</a>
|
| 2 |
|
| 3 |
+
#### Overview <a id="syserr.errcode.overview">[[syserr.errcode.overview]]</a>
|
| 4 |
|
| 5 |
The class `error_code` describes an object used to hold error code
|
| 6 |
values, such as those originating from the operating system or other
|
| 7 |
low-level application program interfaces.
|
| 8 |
|
|
|
|
| 44 |
basic_ostream<charT, traits>&
|
| 45 |
operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
|
| 46 |
}
|
| 47 |
```
|
| 48 |
|
| 49 |
+
#### Constructors <a id="syserr.errcode.constructors">[[syserr.errcode.constructors]]</a>
|
| 50 |
|
| 51 |
``` cpp
|
| 52 |
error_code() noexcept;
|
| 53 |
```
|
| 54 |
|
| 55 |
+
*Ensures:* `val_ == 0` and `cat_ == &system_category()`.
|
|
|
|
|
|
|
| 56 |
|
| 57 |
``` cpp
|
| 58 |
error_code(int val, const error_category& cat) noexcept;
|
| 59 |
```
|
| 60 |
|
| 61 |
+
*Ensures:* `val_ == val` and `cat_ == &cat`.
|
|
|
|
|
|
|
| 62 |
|
| 63 |
``` cpp
|
| 64 |
template<class ErrorCodeEnum>
|
| 65 |
error_code(ErrorCodeEnum e) noexcept;
|
| 66 |
```
|
| 67 |
|
| 68 |
+
*Constraints:* `is_error_code_enum_v<ErrorCodeEnum>` is `true`.
|
| 69 |
|
| 70 |
+
*Ensures:* `*this == make_error_code(e)`.
|
| 71 |
|
| 72 |
+
#### Modifiers <a id="syserr.errcode.modifiers">[[syserr.errcode.modifiers]]</a>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
``` cpp
|
| 75 |
void assign(int val, const error_category& cat) noexcept;
|
| 76 |
```
|
| 77 |
|
| 78 |
+
*Ensures:* `val_ == val` and `cat_ == &cat`.
|
| 79 |
|
| 80 |
``` cpp
|
| 81 |
template<class ErrorCodeEnum>
|
| 82 |
error_code& operator=(ErrorCodeEnum e) noexcept;
|
| 83 |
```
|
| 84 |
|
| 85 |
+
*Constraints:* `is_error_code_enum_v<ErrorCodeEnum>` is `true`.
|
| 86 |
+
|
| 87 |
+
*Ensures:* `*this == make_error_code(e)`.
|
| 88 |
|
| 89 |
*Returns:* `*this`.
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
``` cpp
|
| 92 |
void clear() noexcept;
|
| 93 |
```
|
| 94 |
|
| 95 |
+
*Ensures:* `value() == 0` and `category() == system_category()`.
|
| 96 |
|
| 97 |
+
#### Observers <a id="syserr.errcode.observers">[[syserr.errcode.observers]]</a>
|
| 98 |
|
| 99 |
``` cpp
|
| 100 |
int value() const noexcept;
|
| 101 |
```
|
| 102 |
|
|
|
|
| 124 |
explicit operator bool() const noexcept;
|
| 125 |
```
|
| 126 |
|
| 127 |
*Returns:* `value() != 0`.
|
| 128 |
|
| 129 |
+
#### Non-member functions <a id="syserr.errcode.nonmembers">[[syserr.errcode.nonmembers]]</a>
|
| 130 |
|
| 131 |
``` cpp
|
| 132 |
error_code make_error_code(errc e) noexcept;
|
| 133 |
```
|
| 134 |
|
| 135 |
*Returns:* `error_code(static_cast<int>(e), generic_category())`.
|
| 136 |
|
| 137 |
``` cpp
|
| 138 |
template<class charT, class traits>
|
| 139 |
+
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const error_code& ec);
|
|
|
|
| 140 |
```
|
| 141 |
|
| 142 |
+
*Effects:* Equivalent to:
|
| 143 |
+
`return os << ec.category().name() << ’:’ << ec.value();`
|
| 144 |
|