|
1 | 1 | --- |
2 | | -description: "Learn more about: <system_error> operators" |
3 | 2 | title: "<system_error> operators" |
| 3 | +description: "Learn more about: <system_error> operators" |
4 | 4 | ms.date: "11/04/2016" |
5 | 5 | f1_keywords: ["system_error/std::operator!=", "system_error/std::operator=="] |
6 | | -ms.assetid: c14edefb-bd8a-4e90-88d3-c59c98e6f73c |
7 | 6 | --- |
8 | 7 | # `<system_error>` operators |
9 | 8 |
|
10 | | -## <a name="op_eq_eq"></a> operator== |
| 9 | +## <a name="op_eq_eq"></a> `operator==` |
11 | 10 |
|
12 | 11 | Tests if the object on the left side of the operator is equal to the object on the right side. |
13 | 12 |
|
@@ -38,7 +37,7 @@ The object to be tested for equality. |
38 | 37 |
|
39 | 38 | This function returns `left.category() == right.category() && left.value() == right.value()`. |
40 | 39 |
|
41 | | -## <a name="op_neq"></a> operator!= |
| 40 | +## <a name="op_neq"></a> `operator!=` |
42 | 41 |
|
43 | 42 | Tests if the object on the left side of the operator is not equal to the object on the right side. |
44 | 43 |
|
@@ -111,7 +110,42 @@ This function tests the error order. |
111 | 110 |
|
112 | 111 | ## <a name="op_ostream"></a> `operator<<` |
113 | 112 |
|
| 113 | +Inserts an [`error_code`](error-code-class.md) object into the output stream. |
| 114 | + |
114 | 115 | ```cpp |
115 | 116 | template <class charT, class traits> |
116 | | - basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const error_code& ec); |
| 117 | +basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& os, const error_code& ec); |
| 118 | +``` |
| 119 | +
|
| 120 | +### Parameters |
| 121 | +
|
| 122 | +*os*\ |
| 123 | +The target output stream. |
| 124 | +
|
| 125 | +*ec*\ |
| 126 | +The `error_code` object to be output. |
| 127 | +
|
| 128 | +### Return Value |
| 129 | +
|
| 130 | +A reference to the modified output stream. |
| 131 | +
|
| 132 | +### Remarks |
| 133 | +
|
| 134 | +This operator does the equivalent of `os << ec.category().name() << ':' << ec.value()`. |
| 135 | +
|
| 136 | +### Example |
| 137 | +
|
| 138 | +```cpp |
| 139 | +#include <iostream> |
| 140 | +#include <system_error> |
| 141 | +
|
| 142 | +int main() |
| 143 | +{ |
| 144 | + std::error_code ec(1234, std::generic_category()); |
| 145 | + std::cout << ec; |
| 146 | +} |
| 147 | +``` |
| 148 | + |
| 149 | +```Output |
| 150 | +generic:1234 |
117 | 151 | ``` |
0 commit comments