tmp/tmp27vkfjsa/{from.md → to.md}
RENAMED
|
@@ -6,11 +6,11 @@ Each formatted output function begins execution by constructing an
|
|
| 6 |
object of class `sentry`. If this object returns `true` when converted
|
| 7 |
to a value of type `bool`, the function endeavors to generate the
|
| 8 |
requested output. If the generation fails, then the formatted output
|
| 9 |
function does `setstate(ios_base::failbit)`, which might throw an
|
| 10 |
exception. If an exception is thrown during output, then `ios::badbit`
|
| 11 |
-
is turned on[^
|
| 12 |
`(exceptions()&badbit) != 0` then the exception is rethrown. Whether or
|
| 13 |
not an exception is thrown, the `sentry` object is destroyed before
|
| 14 |
leaving the formatted output function. If no exception is thrown, the
|
| 15 |
result of the formatted output function is `*this`.
|
| 16 |
|
|
@@ -107,59 +107,57 @@ bool failed = use_facet<
|
|
| 107 |
The first argument provides an object of the `ostreambuf_iterator<>`
|
| 108 |
class which is an iterator for class `basic_ostream<>`. It bypasses
|
| 109 |
`ostream`s and uses `streambuf`s directly. Class `locale` relies on
|
| 110 |
these types as its interface to iostreams, since for flexibility it has
|
| 111 |
been abstracted away from direct dependence on `ostream`. The second
|
| 112 |
-
parameter is a reference to the base subobject of type `ios_base`.
|
| 113 |
-
provides formatting specifications such as field width, and a locale
|
| 114 |
from which to obtain other facets. If `failed` is `true` then does
|
| 115 |
`setstate(badbit)`, which may throw an exception, and returns.
|
| 116 |
|
| 117 |
*Returns:* `*this`.
|
| 118 |
|
| 119 |
##### `basic_ostream::operator<<` <a id="ostream.inserters">[[ostream.inserters]]</a>
|
| 120 |
|
| 121 |
``` cpp
|
| 122 |
-
basic_ostream<charT,traits>&
|
| 123 |
-
|
| 124 |
```
|
| 125 |
|
| 126 |
*Effects:* None. Does not behave as a formatted output function (as
|
| 127 |
described in [[ostream.formatted.reqmts]]).
|
| 128 |
|
| 129 |
-
*Returns:* `pf(*this)`.[^
|
| 130 |
|
| 131 |
``` cpp
|
| 132 |
-
basic_ostream<charT,traits>&
|
| 133 |
-
|
| 134 |
```
|
| 135 |
|
| 136 |
*Effects:* Calls `pf(*this)`. This inserter does not behave as a
|
| 137 |
formatted output function (as described
|
| 138 |
in [[ostream.formatted.reqmts]]).
|
| 139 |
|
| 140 |
-
*Returns:* `*this`.[^
|
| 141 |
|
| 142 |
``` cpp
|
| 143 |
-
basic_ostream<charT,traits>& operator<<
|
| 144 |
-
(ios_base& (*pf)(ios_base&));
|
| 145 |
```
|
| 146 |
|
| 147 |
*Effects:* Calls `pf(*this)`. This inserter does not behave as a
|
| 148 |
formatted output function (as described
|
| 149 |
in [[ostream.formatted.reqmts]]).
|
| 150 |
|
| 151 |
*Returns:* `*this`.
|
| 152 |
|
| 153 |
``` cpp
|
| 154 |
-
basic_ostream<charT,traits>& operator<<
|
| 155 |
-
(basic_streambuf<charT,traits>* sb);
|
| 156 |
```
|
| 157 |
|
| 158 |
-
*Effects:* Behaves as an unformatted output function
|
| 159 |
-
|
| 160 |
-
|
| 161 |
`ios_base::failure`).
|
| 162 |
|
| 163 |
Gets characters from `sb` and inserts them in `*this`. Characters are
|
| 164 |
read from `sb` and inserted until any of the following occurs:
|
| 165 |
|
|
@@ -174,55 +172,58 @@ exception was thrown while extracting a character, the function sets
|
|
| 174 |
`failbit` in error state, and if `failbit` is on in `exceptions()` the
|
| 175 |
caught exception is rethrown.
|
| 176 |
|
| 177 |
*Returns:* `*this`.
|
| 178 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
##### Character inserter function templates <a id="ostream.inserters.character">[[ostream.inserters.character]]</a>
|
| 180 |
|
| 181 |
``` cpp
|
| 182 |
template<class charT, class traits>
|
| 183 |
-
basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
|
| 184 |
-
charT c);
|
| 185 |
template<class charT, class traits>
|
| 186 |
-
basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
|
| 187 |
-
char c);
|
| 188 |
// specialization
|
| 189 |
template<class traits>
|
| 190 |
-
basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out,
|
| 191 |
-
char c);
|
| 192 |
// signed and unsigned
|
| 193 |
template<class traits>
|
| 194 |
-
basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out,
|
| 195 |
-
signed char c);
|
| 196 |
template<class traits>
|
| 197 |
-
basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out,
|
| 198 |
-
unsigned char c);
|
| 199 |
```
|
| 200 |
|
| 201 |
-
*Effects:* Behaves as a formatted output
|
| 202 |
-
(
|
| 203 |
-
sequence `seq`. If `c` has type `char` and the character type
|
| 204 |
-
stream is not `char`, then `seq` consists of `out.widen(c)`;
|
| 205 |
-
`seq` consists of `c`. Determines padding for `seq` as
|
| 206 |
-
in [[ostream.formatted.reqmts]]. Inserts `seq` into `out`.
|
| 207 |
-
`os.width(0)`.
|
| 208 |
|
| 209 |
*Returns:* `out`.
|
| 210 |
|
| 211 |
``` cpp
|
| 212 |
template<class charT, class traits>
|
| 213 |
-
basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
|
| 214 |
-
const charT* s);
|
| 215 |
template<class charT, class traits>
|
| 216 |
-
basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
|
| 217 |
-
const char* s);
|
| 218 |
template<class traits>
|
| 219 |
-
basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out,
|
| 220 |
-
const char* s);
|
| 221 |
template<class traits>
|
| 222 |
-
basic_ostream<char,traits>& operator<<(basic_ostream<char,traits>& out,
|
| 223 |
-
const signed char* s);
|
| 224 |
template<class traits>
|
| 225 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out,
|
| 226 |
const unsigned char* s);
|
| 227 |
```
|
| 228 |
|
|
@@ -237,11 +238,11 @@ would be computed as if by:
|
|
| 237 |
- `traits::length(s)` for the overload where the first argument is of
|
| 238 |
type `basic_ostream<charT, traits>&` and the second is of type
|
| 239 |
`const charT*`, and also for the overload where the first argument is
|
| 240 |
of type `basic_ostream<char, traits>&` and the second is of type
|
| 241 |
`const char*`,
|
| 242 |
-
- `
|
| 243 |
argument is of type `basic_ostream<charT, traits>&` and the second is
|
| 244 |
of type `const char*`,
|
| 245 |
- `traits::length(reinterpret_cast<const char*>(s))` for the other two
|
| 246 |
overloads.
|
| 247 |
|
|
|
|
| 6 |
object of class `sentry`. If this object returns `true` when converted
|
| 7 |
to a value of type `bool`, the function endeavors to generate the
|
| 8 |
requested output. If the generation fails, then the formatted output
|
| 9 |
function does `setstate(ios_base::failbit)`, which might throw an
|
| 10 |
exception. If an exception is thrown during output, then `ios::badbit`
|
| 11 |
+
is turned on[^33] in `*this`’s error state. If
|
| 12 |
`(exceptions()&badbit) != 0` then the exception is rethrown. Whether or
|
| 13 |
not an exception is thrown, the `sentry` object is destroyed before
|
| 14 |
leaving the formatted output function. If no exception is thrown, the
|
| 15 |
result of the formatted output function is `*this`.
|
| 16 |
|
|
|
|
| 107 |
The first argument provides an object of the `ostreambuf_iterator<>`
|
| 108 |
class which is an iterator for class `basic_ostream<>`. It bypasses
|
| 109 |
`ostream`s and uses `streambuf`s directly. Class `locale` relies on
|
| 110 |
these types as its interface to iostreams, since for flexibility it has
|
| 111 |
been abstracted away from direct dependence on `ostream`. The second
|
| 112 |
+
parameter is a reference to the base class subobject of type `ios_base`.
|
| 113 |
+
It provides formatting specifications such as field width, and a locale
|
| 114 |
from which to obtain other facets. If `failed` is `true` then does
|
| 115 |
`setstate(badbit)`, which may throw an exception, and returns.
|
| 116 |
|
| 117 |
*Returns:* `*this`.
|
| 118 |
|
| 119 |
##### `basic_ostream::operator<<` <a id="ostream.inserters">[[ostream.inserters]]</a>
|
| 120 |
|
| 121 |
``` cpp
|
| 122 |
+
basic_ostream<charT, traits>&
|
| 123 |
+
operator<<(basic_ostream<charT, traits>& (*pf)(basic_ostream<charT, traits>&));
|
| 124 |
```
|
| 125 |
|
| 126 |
*Effects:* None. Does not behave as a formatted output function (as
|
| 127 |
described in [[ostream.formatted.reqmts]]).
|
| 128 |
|
| 129 |
+
*Returns:* `pf(*this)`.[^34]
|
| 130 |
|
| 131 |
``` cpp
|
| 132 |
+
basic_ostream<charT, traits>&
|
| 133 |
+
operator<<(basic_ios<charT, traits>& (*pf)(basic_ios<charT, traits>&));
|
| 134 |
```
|
| 135 |
|
| 136 |
*Effects:* Calls `pf(*this)`. This inserter does not behave as a
|
| 137 |
formatted output function (as described
|
| 138 |
in [[ostream.formatted.reqmts]]).
|
| 139 |
|
| 140 |
+
*Returns:* `*this`.[^35]
|
| 141 |
|
| 142 |
``` cpp
|
| 143 |
+
basic_ostream<charT, traits>& operator<<(ios_base& (*pf)(ios_base&));
|
|
|
|
| 144 |
```
|
| 145 |
|
| 146 |
*Effects:* Calls `pf(*this)`. This inserter does not behave as a
|
| 147 |
formatted output function (as described
|
| 148 |
in [[ostream.formatted.reqmts]]).
|
| 149 |
|
| 150 |
*Returns:* `*this`.
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
+
basic_ostream<charT, traits>& operator<<(basic_streambuf<charT, traits>* sb);
|
|
|
|
| 154 |
```
|
| 155 |
|
| 156 |
+
*Effects:* Behaves as an unformatted output function
|
| 157 |
+
([[ostream.unformatted]]). After the sentry object is constructed, if
|
| 158 |
+
`sb` is null calls `setstate(badbit)` (which may throw
|
| 159 |
`ios_base::failure`).
|
| 160 |
|
| 161 |
Gets characters from `sb` and inserts them in `*this`. Characters are
|
| 162 |
read from `sb` and inserted until any of the following occurs:
|
| 163 |
|
|
|
|
| 172 |
`failbit` in error state, and if `failbit` is on in `exceptions()` the
|
| 173 |
caught exception is rethrown.
|
| 174 |
|
| 175 |
*Returns:* `*this`.
|
| 176 |
|
| 177 |
+
``` cpp
|
| 178 |
+
basic_ostream<charT, traits>& operator<<(nullptr_t);
|
| 179 |
+
```
|
| 180 |
+
|
| 181 |
+
*Effects:* Equivalent to:
|
| 182 |
+
|
| 183 |
+
``` cpp
|
| 184 |
+
return *this << s;
|
| 185 |
+
```
|
| 186 |
+
|
| 187 |
+
where `s` is an *implementation-defined* NTCTS ([[defns.ntcts]]).
|
| 188 |
+
|
| 189 |
##### Character inserter function templates <a id="ostream.inserters.character">[[ostream.inserters.character]]</a>
|
| 190 |
|
| 191 |
``` cpp
|
| 192 |
template<class charT, class traits>
|
| 193 |
+
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& out, charT c);
|
|
|
|
| 194 |
template<class charT, class traits>
|
| 195 |
+
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& out, char c);
|
|
|
|
| 196 |
// specialization
|
| 197 |
template<class traits>
|
| 198 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out, char c);
|
|
|
|
| 199 |
// signed and unsigned
|
| 200 |
template<class traits>
|
| 201 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out, signed char c);
|
|
|
|
| 202 |
template<class traits>
|
| 203 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out, unsigned char c);
|
|
|
|
| 204 |
```
|
| 205 |
|
| 206 |
+
*Effects:* Behaves as a formatted output
|
| 207 |
+
function ([[ostream.formatted.reqmts]]) of `out`. Constructs a
|
| 208 |
+
character sequence `seq`. If `c` has type `char` and the character type
|
| 209 |
+
of the stream is not `char`, then `seq` consists of `out.widen(c)`;
|
| 210 |
+
otherwise `seq` consists of `c`. Determines padding for `seq` as
|
| 211 |
+
described in [[ostream.formatted.reqmts]]. Inserts `seq` into `out`.
|
| 212 |
+
Calls `os.width(0)`.
|
| 213 |
|
| 214 |
*Returns:* `out`.
|
| 215 |
|
| 216 |
``` cpp
|
| 217 |
template<class charT, class traits>
|
| 218 |
+
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& out, const charT* s);
|
|
|
|
| 219 |
template<class charT, class traits>
|
| 220 |
+
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& out, const char* s);
|
|
|
|
| 221 |
template<class traits>
|
| 222 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out, const char* s);
|
|
|
|
| 223 |
template<class traits>
|
| 224 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out, const signed char* s);
|
|
|
|
| 225 |
template<class traits>
|
| 226 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>& out,
|
| 227 |
const unsigned char* s);
|
| 228 |
```
|
| 229 |
|
|
|
|
| 238 |
- `traits::length(s)` for the overload where the first argument is of
|
| 239 |
type `basic_ostream<charT, traits>&` and the second is of type
|
| 240 |
`const charT*`, and also for the overload where the first argument is
|
| 241 |
of type `basic_ostream<char, traits>&` and the second is of type
|
| 242 |
`const char*`,
|
| 243 |
+
- `char_traits<char>::length(s)` for the overload where the first
|
| 244 |
argument is of type `basic_ostream<charT, traits>&` and the second is
|
| 245 |
of type `const char*`,
|
| 246 |
- `traits::length(reinterpret_cast<const char*>(s))` for the other two
|
| 247 |
overloads.
|
| 248 |
|