tmp/tmpmllusdys/{from.md → to.md}
RENAMED
|
@@ -3,22 +3,22 @@
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class charT, class traits = char_traits<charT>>
|
| 6 |
class basic_ostream : virtual public basic_ios<charT, traits> {
|
| 7 |
public:
|
| 8 |
-
// types (inherited from basic_ios
|
| 9 |
using char_type = charT;
|
| 10 |
using int_type = typename traits::int_type;
|
| 11 |
using pos_type = typename traits::pos_type;
|
| 12 |
using off_type = typename traits::off_type;
|
| 13 |
using traits_type = traits;
|
| 14 |
|
| 15 |
// [ostream.cons], constructor/destructor
|
| 16 |
explicit basic_ostream(basic_streambuf<char_type, traits>* sb);
|
| 17 |
virtual ~basic_ostream();
|
| 18 |
|
| 19 |
-
// [ostream
|
| 20 |
class sentry;
|
| 21 |
|
| 22 |
// [ostream.formatted], formatted output
|
| 23 |
basic_ostream<charT, traits>&
|
| 24 |
operator<<(basic_ostream<charT, traits>& (*pf)(basic_ostream<charT, traits>&));
|
|
@@ -55,15 +55,15 @@ namespace std {
|
|
| 55 |
basic_ostream<charT, traits>& seekp(pos_type);
|
| 56 |
basic_ostream<charT, traits>& seekp(off_type, ios_base::seekdir);
|
| 57 |
|
| 58 |
protected:
|
| 59 |
// [ostream.cons], copy/move constructor
|
| 60 |
-
basic_ostream(const basic_ostream&
|
| 61 |
basic_ostream(basic_ostream&& rhs);
|
| 62 |
|
| 63 |
// [ostream.assign], assign and swap
|
| 64 |
-
basic_ostream& operator=(const basic_ostream&
|
| 65 |
basic_ostream& operator=(basic_ostream&& rhs);
|
| 66 |
void swap(basic_ostream& rhs);
|
| 67 |
};
|
| 68 |
|
| 69 |
// [ostream.inserters.character], character inserters
|
|
@@ -77,10 +77,28 @@ namespace std {
|
|
| 77 |
template<class traits>
|
| 78 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, signed char);
|
| 79 |
template<class traits>
|
| 80 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, unsigned char);
|
| 81 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
template<class charT, class traits>
|
| 83 |
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>&, const charT*);
|
| 84 |
template<class charT, class traits>
|
| 85 |
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>&, const char*);
|
| 86 |
template<class traits>
|
|
@@ -88,10 +106,32 @@ namespace std {
|
|
| 88 |
|
| 89 |
template<class traits>
|
| 90 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const signed char*);
|
| 91 |
template<class traits>
|
| 92 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const unsigned char*);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
}
|
| 94 |
```
|
| 95 |
|
| 96 |
The class template `basic_ostream` defines a number of member function
|
| 97 |
signatures that assist in formatting and writing output to output
|
|
@@ -104,26 +144,29 @@ output functions.* Both groups of output functions generate (or
|
|
| 104 |
`rdbuf()->sputc(int_type)`. They may use other public members of
|
| 105 |
`basic_ostream` except that they shall not invoke any virtual members of
|
| 106 |
`rdbuf()` except `overflow()`, `xsputn()`, and `sync()`.
|
| 107 |
|
| 108 |
If one of these called functions throws an exception, then unless
|
| 109 |
-
explicitly noted otherwise the output function sets `badbit` in
|
| 110 |
-
state. If `badbit` is
|
| 111 |
-
the exception without completing its actions, otherwise it does
|
| 112 |
-
throw anything and
|
|
|
|
| 113 |
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
| 115 |
|
| 116 |
``` cpp
|
| 117 |
explicit basic_ostream(basic_streambuf<charT, traits>* sb);
|
| 118 |
```
|
| 119 |
|
| 120 |
-
*Effects:*
|
| 121 |
-
|
| 122 |
-
`basic_ios<charT, traits>::init(sb)` ([[basic.ios.cons]]).
|
| 123 |
|
| 124 |
-
*
|
| 125 |
|
| 126 |
``` cpp
|
| 127 |
basic_ostream(basic_ostream&& rhs);
|
| 128 |
```
|
| 129 |
|
|
@@ -133,31 +176,29 @@ by default constructing the base class and calling
|
|
| 133 |
|
| 134 |
``` cpp
|
| 135 |
virtual ~basic_ostream();
|
| 136 |
```
|
| 137 |
|
| 138 |
-
*Effects:* Destroys an object of class `basic_ostream`.
|
| 139 |
-
|
| 140 |
*Remarks:* Does not perform any operations on `rdbuf()`.
|
| 141 |
|
| 142 |
-
#####
|
| 143 |
|
| 144 |
``` cpp
|
| 145 |
basic_ostream& operator=(basic_ostream&& rhs);
|
| 146 |
```
|
| 147 |
|
| 148 |
-
*Effects:*
|
| 149 |
|
| 150 |
*Returns:* `*this`.
|
| 151 |
|
| 152 |
``` cpp
|
| 153 |
void swap(basic_ostream& rhs);
|
| 154 |
```
|
| 155 |
|
| 156 |
*Effects:* Calls `basic_ios<charT, traits>::swap(rhs)`.
|
| 157 |
|
| 158 |
-
##### Class `basic_ostream::sentry` <a id="ostream
|
| 159 |
|
| 160 |
``` cpp
|
| 161 |
namespace std {
|
| 162 |
template<class charT, class traits = char_traits<charT>>
|
| 163 |
class basic_ostream<charT, traits>::sentry {
|
|
@@ -184,11 +225,11 @@ If `os.good()` is nonzero, prepares for formatted or unformatted output.
|
|
| 184 |
If `os.tie()` is not a null pointer, calls `os.tie()->flush()`.[^31]
|
| 185 |
|
| 186 |
If, after any preparation is completed, `os.good()` is `true`,
|
| 187 |
`ok_ == true` otherwise, `ok_ == false`. During preparation, the
|
| 188 |
constructor may call `setstate(failbit)` (which may throw
|
| 189 |
-
`ios_base::failure`
|
| 190 |
|
| 191 |
``` cpp
|
| 192 |
~sentry();
|
| 193 |
```
|
| 194 |
|
|
@@ -201,11 +242,11 @@ sets `badbit` in `os.rdstate()` without propagating an exception.
|
|
| 201 |
explicit operator bool() const;
|
| 202 |
```
|
| 203 |
|
| 204 |
*Effects:* Returns `ok_`.
|
| 205 |
|
| 206 |
-
#####
|
| 207 |
|
| 208 |
Each seek member function begins execution by constructing an object of
|
| 209 |
class `sentry`. It returns by destroying the `sentry` object.
|
| 210 |
|
| 211 |
``` cpp
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class charT, class traits = char_traits<charT>>
|
| 6 |
class basic_ostream : virtual public basic_ios<charT, traits> {
|
| 7 |
public:
|
| 8 |
+
// types (inherited from basic_ios[ios])
|
| 9 |
using char_type = charT;
|
| 10 |
using int_type = typename traits::int_type;
|
| 11 |
using pos_type = typename traits::pos_type;
|
| 12 |
using off_type = typename traits::off_type;
|
| 13 |
using traits_type = traits;
|
| 14 |
|
| 15 |
// [ostream.cons], constructor/destructor
|
| 16 |
explicit basic_ostream(basic_streambuf<char_type, traits>* sb);
|
| 17 |
virtual ~basic_ostream();
|
| 18 |
|
| 19 |
+
// [ostream.sentry], prefix/suffix
|
| 20 |
class sentry;
|
| 21 |
|
| 22 |
// [ostream.formatted], formatted output
|
| 23 |
basic_ostream<charT, traits>&
|
| 24 |
operator<<(basic_ostream<charT, traits>& (*pf)(basic_ostream<charT, traits>&));
|
|
|
|
| 55 |
basic_ostream<charT, traits>& seekp(pos_type);
|
| 56 |
basic_ostream<charT, traits>& seekp(off_type, ios_base::seekdir);
|
| 57 |
|
| 58 |
protected:
|
| 59 |
// [ostream.cons], copy/move constructor
|
| 60 |
+
basic_ostream(const basic_ostream&) = delete;
|
| 61 |
basic_ostream(basic_ostream&& rhs);
|
| 62 |
|
| 63 |
// [ostream.assign], assign and swap
|
| 64 |
+
basic_ostream& operator=(const basic_ostream&) = delete;
|
| 65 |
basic_ostream& operator=(basic_ostream&& rhs);
|
| 66 |
void swap(basic_ostream& rhs);
|
| 67 |
};
|
| 68 |
|
| 69 |
// [ostream.inserters.character], character inserters
|
|
|
|
| 77 |
template<class traits>
|
| 78 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, signed char);
|
| 79 |
template<class traits>
|
| 80 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, unsigned char);
|
| 81 |
|
| 82 |
+
template<class traits>
|
| 83 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, wchar_t) = delete;
|
| 84 |
+
template<class traits>
|
| 85 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char8_t) = delete;
|
| 86 |
+
template<class traits>
|
| 87 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char16_t) = delete;
|
| 88 |
+
template<class traits>
|
| 89 |
+
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, char32_t) = delete;
|
| 90 |
+
template<class traits>
|
| 91 |
+
basic_ostream<wchar_t, traits>&
|
| 92 |
+
operator<<(basic_ostream<wchar_t, traits>&, char8_t) = delete;
|
| 93 |
+
template<class traits>
|
| 94 |
+
basic_ostream<wchar_t, traits>&
|
| 95 |
+
operator<<(basic_ostream<wchar_t, traits>&, char16_t) = delete;
|
| 96 |
+
template<class traits>
|
| 97 |
+
basic_ostream<wchar_t, traits>&
|
| 98 |
+
operator<<(basic_ostream<wchar_t, traits>&, char32_t) = delete;
|
| 99 |
+
|
| 100 |
template<class charT, class traits>
|
| 101 |
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>&, const charT*);
|
| 102 |
template<class charT, class traits>
|
| 103 |
basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>&, const char*);
|
| 104 |
template<class traits>
|
|
|
|
| 106 |
|
| 107 |
template<class traits>
|
| 108 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const signed char*);
|
| 109 |
template<class traits>
|
| 110 |
basic_ostream<char, traits>& operator<<(basic_ostream<char, traits>&, const unsigned char*);
|
| 111 |
+
|
| 112 |
+
template<class traits>
|
| 113 |
+
basic_ostream<char, traits>&
|
| 114 |
+
operator<<(basic_ostream<char, traits>&, const wchar_t*) = delete;
|
| 115 |
+
template<class traits>
|
| 116 |
+
basic_ostream<char, traits>&
|
| 117 |
+
operator<<(basic_ostream<char, traits>&, const char8_t*) = delete;
|
| 118 |
+
template<class traits>
|
| 119 |
+
basic_ostream<char, traits>&
|
| 120 |
+
operator<<(basic_ostream<char, traits>&, const char16_t*) = delete;
|
| 121 |
+
template<class traits>
|
| 122 |
+
basic_ostream<char, traits>&
|
| 123 |
+
operator<<(basic_ostream<char, traits>&, const char32_t*) = delete;
|
| 124 |
+
template<class traits>
|
| 125 |
+
basic_ostream<wchar_t, traits>&
|
| 126 |
+
operator<<(basic_ostream<wchar_t, traits>&, const char8_t*) = delete;
|
| 127 |
+
template<class traits>
|
| 128 |
+
basic_ostream<wchar_t, traits>&
|
| 129 |
+
operator<<(basic_ostream<wchar_t, traits>&, const char16_t*) = delete;
|
| 130 |
+
template<class traits>
|
| 131 |
+
basic_ostream<wchar_t, traits>&
|
| 132 |
+
operator<<(basic_ostream<wchar_t, traits>&, const char32_t*) = delete;
|
| 133 |
}
|
| 134 |
```
|
| 135 |
|
| 136 |
The class template `basic_ostream` defines a number of member function
|
| 137 |
signatures that assist in formatting and writing output to output
|
|
|
|
| 144 |
`rdbuf()->sputc(int_type)`. They may use other public members of
|
| 145 |
`basic_ostream` except that they shall not invoke any virtual members of
|
| 146 |
`rdbuf()` except `overflow()`, `xsputn()`, and `sync()`.
|
| 147 |
|
| 148 |
If one of these called functions throws an exception, then unless
|
| 149 |
+
explicitly noted otherwise the output function sets `badbit` in the
|
| 150 |
+
error state. If `badbit` is set in `exceptions()`, the output function
|
| 151 |
+
rethrows the exception without completing its actions, otherwise it does
|
| 152 |
+
not throw anything and proceeds as if the called function had returned a
|
| 153 |
+
failure indication.
|
| 154 |
|
| 155 |
+
[*Note 1*: The deleted overloads of `operator<<` prevent formatting
|
| 156 |
+
characters as integers and strings as pointers. — *end note*]
|
| 157 |
+
|
| 158 |
+
##### Constructors <a id="ostream.cons">[[ostream.cons]]</a>
|
| 159 |
|
| 160 |
``` cpp
|
| 161 |
explicit basic_ostream(basic_streambuf<charT, traits>* sb);
|
| 162 |
```
|
| 163 |
|
| 164 |
+
*Effects:* Initializes the base class subobject with
|
| 165 |
+
`basic_ios<charT, traits>::init(sb)` [[basic.ios.cons]].
|
|
|
|
| 166 |
|
| 167 |
+
*Ensures:* `rdbuf() == sb`.
|
| 168 |
|
| 169 |
``` cpp
|
| 170 |
basic_ostream(basic_ostream&& rhs);
|
| 171 |
```
|
| 172 |
|
|
|
|
| 176 |
|
| 177 |
``` cpp
|
| 178 |
virtual ~basic_ostream();
|
| 179 |
```
|
| 180 |
|
|
|
|
|
|
|
| 181 |
*Remarks:* Does not perform any operations on `rdbuf()`.
|
| 182 |
|
| 183 |
+
##### Assignment and swap <a id="ostream.assign">[[ostream.assign]]</a>
|
| 184 |
|
| 185 |
``` cpp
|
| 186 |
basic_ostream& operator=(basic_ostream&& rhs);
|
| 187 |
```
|
| 188 |
|
| 189 |
+
*Effects:* Equivalent to: `swap(rhs)`.
|
| 190 |
|
| 191 |
*Returns:* `*this`.
|
| 192 |
|
| 193 |
``` cpp
|
| 194 |
void swap(basic_ostream& rhs);
|
| 195 |
```
|
| 196 |
|
| 197 |
*Effects:* Calls `basic_ios<charT, traits>::swap(rhs)`.
|
| 198 |
|
| 199 |
+
##### Class `basic_ostream::sentry` <a id="ostream.sentry">[[ostream.sentry]]</a>
|
| 200 |
|
| 201 |
``` cpp
|
| 202 |
namespace std {
|
| 203 |
template<class charT, class traits = char_traits<charT>>
|
| 204 |
class basic_ostream<charT, traits>::sentry {
|
|
|
|
| 225 |
If `os.tie()` is not a null pointer, calls `os.tie()->flush()`.[^31]
|
| 226 |
|
| 227 |
If, after any preparation is completed, `os.good()` is `true`,
|
| 228 |
`ok_ == true` otherwise, `ok_ == false`. During preparation, the
|
| 229 |
constructor may call `setstate(failbit)` (which may throw
|
| 230 |
+
`ios_base::failure` [[iostate.flags]]).[^32]
|
| 231 |
|
| 232 |
``` cpp
|
| 233 |
~sentry();
|
| 234 |
```
|
| 235 |
|
|
|
|
| 242 |
explicit operator bool() const;
|
| 243 |
```
|
| 244 |
|
| 245 |
*Effects:* Returns `ok_`.
|
| 246 |
|
| 247 |
+
##### Seek members <a id="ostream.seeks">[[ostream.seeks]]</a>
|
| 248 |
|
| 249 |
Each seek member function begins execution by constructing an object of
|
| 250 |
class `sentry`. It returns by destroying the `sentry` object.
|
| 251 |
|
| 252 |
``` cpp
|