tmp/tmpizk6ed25/{from.md → to.md}
RENAMED
|
@@ -2,18 +2,17 @@
|
|
| 2 |
|
| 3 |
#### General <a id="ostringstream.general">[[ostringstream.general]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
-
template<class charT, class traits = char_traits<charT>,
|
| 8 |
-
class Allocator = allocator<charT>>
|
| 9 |
class basic_ostringstream : public basic_ostream<charT, traits> {
|
| 10 |
public:
|
| 11 |
using char_type = charT;
|
| 12 |
-
using int_type =
|
| 13 |
-
using pos_type =
|
| 14 |
-
using off_type =
|
| 15 |
using traits_type = traits;
|
| 16 |
using allocator_type = Allocator;
|
| 17 |
|
| 18 |
// [ostringstream.cons], constructors
|
| 19 |
basic_ostringstream() : basic_ostringstream(ios_base::out) {}
|
|
@@ -35,10 +34,16 @@ namespace std {
|
|
| 35 |
ios_base::openmode which, const Allocator& a);
|
| 36 |
template<class SAlloc>
|
| 37 |
explicit basic_ostringstream(
|
| 38 |
const basic_string<charT, traits, SAlloc>& s,
|
| 39 |
ios_base::openmode which = ios_base::out);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
basic_ostringstream(const basic_ostringstream&) = delete;
|
| 41 |
basic_ostringstream(basic_ostringstream&& rhs);
|
| 42 |
|
| 43 |
basic_ostringstream& operator=(const basic_ostringstream&) = delete;
|
| 44 |
basic_ostringstream& operator=(basic_ostringstream&& rhs);
|
|
@@ -57,10 +62,12 @@ namespace std {
|
|
| 57 |
|
| 58 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 59 |
template<class SAlloc>
|
| 60 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 61 |
void str(basic_string<charT, traits, Allocator>&& s);
|
|
|
|
|
|
|
| 62 |
|
| 63 |
private:
|
| 64 |
basic_stringbuf<charT, traits, Allocator> sb; // exposition only
|
| 65 |
};
|
| 66 |
}
|
|
@@ -69,51 +76,54 @@ namespace std {
|
|
| 69 |
The class `basic_ostringstream<charT, traits, Allocator>` supports
|
| 70 |
writing objects of class `basic_string<{}charT, traits, Allocator>`. It
|
| 71 |
uses a `basic_stringbuf` object to control the associated storage. For
|
| 72 |
the sake of exposition, the maintained data is presented here as:
|
| 73 |
|
| 74 |
-
- `sb`, the `stringbuf` object.
|
| 75 |
|
| 76 |
#### Constructors <a id="ostringstream.cons">[[ostringstream.cons]]</a>
|
| 77 |
|
| 78 |
``` cpp
|
| 79 |
explicit basic_ostringstream(ios_base::openmode which);
|
| 80 |
```
|
| 81 |
|
| 82 |
*Effects:* Initializes the base class with
|
| 83 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
| 84 |
-
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::out)`
|
| 85 |
[[stringbuf.cons]].
|
| 86 |
|
| 87 |
``` cpp
|
| 88 |
explicit basic_ostringstream(
|
| 89 |
const basic_string<charT, traits, Allocator>& s,
|
| 90 |
ios_base::openmode which = ios_base::out);
|
| 91 |
```
|
| 92 |
|
| 93 |
*Effects:* Initializes the base class with
|
| 94 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 95 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out)`
|
| 96 |
[[stringbuf.cons]].
|
| 97 |
|
| 98 |
``` cpp
|
| 99 |
basic_ostringstream(ios_base::openmode which, const Allocator& a);
|
| 100 |
```
|
| 101 |
|
| 102 |
*Effects:* Initializes the base class with
|
| 103 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 104 |
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::out, a)`
|
| 105 |
[[stringbuf.cons]].
|
| 106 |
|
| 107 |
``` cpp
|
| 108 |
explicit basic_ostringstream(
|
| 109 |
basic_string<charT, traits, Allocator>&& s,
|
| 110 |
ios_base::openmode which = ios_base::out);
|
| 111 |
```
|
| 112 |
|
| 113 |
*Effects:* Initializes the base class with
|
| 114 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 115 |
`basic_stringbuf<charT, traits, Allocator>(std::move(s), which | ios_base::out)`
|
| 116 |
[[stringbuf.cons]].
|
| 117 |
|
| 118 |
``` cpp
|
| 119 |
template<class SAlloc>
|
|
@@ -121,11 +131,12 @@ template<class SAlloc>
|
|
| 121 |
const basic_string<charT, traits, SAlloc>& s,
|
| 122 |
ios_base::openmode which, const Allocator& a);
|
| 123 |
```
|
| 124 |
|
| 125 |
*Effects:* Initializes the base class with
|
| 126 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 127 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out, a)`
|
| 128 |
[[stringbuf.cons]].
|
| 129 |
|
| 130 |
``` cpp
|
| 131 |
template<class SAlloc>
|
|
@@ -135,23 +146,44 @@ template<class SAlloc>
|
|
| 135 |
```
|
| 136 |
|
| 137 |
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 138 |
|
| 139 |
*Effects:* Initializes the base class with
|
| 140 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 141 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out)`
|
| 142 |
[[stringbuf.cons]].
|
| 143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 144 |
``` cpp
|
| 145 |
basic_ostringstream(basic_ostringstream&& rhs);
|
| 146 |
```
|
| 147 |
|
| 148 |
*Effects:* Move constructs from the rvalue `rhs`. This is accomplished
|
| 149 |
by move constructing the base class, and the contained
|
| 150 |
`basic_stringbuf`. Then calls
|
| 151 |
-
`basic_ostream<charT, traits>::set_rdbuf(addressof(sb))` to
|
| 152 |
-
contained `basic_stringbuf`.
|
| 153 |
|
| 154 |
#### Swap <a id="ostringstream.swap">[[ostringstream.swap]]</a>
|
| 155 |
|
| 156 |
``` cpp
|
| 157 |
void swap(basic_ostringstream& rhs);
|
|
@@ -168,20 +200,20 @@ sb.swap(rhs.sb);
|
|
| 168 |
template<class charT, class traits, class Allocator>
|
| 169 |
void swap(basic_ostringstream<charT, traits, Allocator>& x,
|
| 170 |
basic_ostringstream<charT, traits, Allocator>& y);
|
| 171 |
```
|
| 172 |
|
| 173 |
-
*Effects:* Equivalent to
|
| 174 |
|
| 175 |
#### Member functions <a id="ostringstream.members">[[ostringstream.members]]</a>
|
| 176 |
|
| 177 |
``` cpp
|
| 178 |
basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
| 179 |
```
|
| 180 |
|
| 181 |
*Returns:*
|
| 182 |
-
`const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(sb))`.
|
| 183 |
|
| 184 |
``` cpp
|
| 185 |
basic_string<charT, traits, Allocator> str() const &;
|
| 186 |
```
|
| 187 |
|
|
@@ -223,5 +255,16 @@ template<class SAlloc>
|
|
| 223 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 224 |
```
|
| 225 |
|
| 226 |
*Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
|
| 227 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
#### General <a id="ostringstream.general">[[ostringstream.general]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
|
|
|
| 8 |
class basic_ostringstream : public basic_ostream<charT, traits> {
|
| 9 |
public:
|
| 10 |
using char_type = charT;
|
| 11 |
+
using int_type = traits::int_type;
|
| 12 |
+
using pos_type = traits::pos_type;
|
| 13 |
+
using off_type = traits::off_type;
|
| 14 |
using traits_type = traits;
|
| 15 |
using allocator_type = Allocator;
|
| 16 |
|
| 17 |
// [ostringstream.cons], constructors
|
| 18 |
basic_ostringstream() : basic_ostringstream(ios_base::out) {}
|
|
|
|
| 34 |
ios_base::openmode which, const Allocator& a);
|
| 35 |
template<class SAlloc>
|
| 36 |
explicit basic_ostringstream(
|
| 37 |
const basic_string<charT, traits, SAlloc>& s,
|
| 38 |
ios_base::openmode which = ios_base::out);
|
| 39 |
+
template<class T>
|
| 40 |
+
explicit basic_ostringstream(const T& t, ios_base::openmode which = ios_base::out);
|
| 41 |
+
template<class T>
|
| 42 |
+
basic_ostringstream(const T& t, const Allocator& a);
|
| 43 |
+
template<class T>
|
| 44 |
+
basic_ostringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
| 45 |
basic_ostringstream(const basic_ostringstream&) = delete;
|
| 46 |
basic_ostringstream(basic_ostringstream&& rhs);
|
| 47 |
|
| 48 |
basic_ostringstream& operator=(const basic_ostringstream&) = delete;
|
| 49 |
basic_ostringstream& operator=(basic_ostringstream&& rhs);
|
|
|
|
| 62 |
|
| 63 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 64 |
template<class SAlloc>
|
| 65 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 66 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 67 |
+
template<class T>
|
| 68 |
+
void str(const T& t);
|
| 69 |
|
| 70 |
private:
|
| 71 |
basic_stringbuf<charT, traits, Allocator> sb; // exposition only
|
| 72 |
};
|
| 73 |
}
|
|
|
|
| 76 |
The class `basic_ostringstream<charT, traits, Allocator>` supports
|
| 77 |
writing objects of class `basic_string<{}charT, traits, Allocator>`. It
|
| 78 |
uses a `basic_stringbuf` object to control the associated storage. For
|
| 79 |
the sake of exposition, the maintained data is presented here as:
|
| 80 |
|
| 81 |
+
- *`sb`*, the `stringbuf` object.
|
| 82 |
|
| 83 |
#### Constructors <a id="ostringstream.cons">[[ostringstream.cons]]</a>
|
| 84 |
|
| 85 |
``` cpp
|
| 86 |
explicit basic_ostringstream(ios_base::openmode which);
|
| 87 |
```
|
| 88 |
|
| 89 |
*Effects:* Initializes the base class with
|
| 90 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 91 |
+
with `basic_stringbuf<charT, traits, Allocator>(which | ios_base::out)`
|
| 92 |
[[stringbuf.cons]].
|
| 93 |
|
| 94 |
``` cpp
|
| 95 |
explicit basic_ostringstream(
|
| 96 |
const basic_string<charT, traits, Allocator>& s,
|
| 97 |
ios_base::openmode which = ios_base::out);
|
| 98 |
```
|
| 99 |
|
| 100 |
*Effects:* Initializes the base class with
|
| 101 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 102 |
+
with
|
| 103 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out)`
|
| 104 |
[[stringbuf.cons]].
|
| 105 |
|
| 106 |
``` cpp
|
| 107 |
basic_ostringstream(ios_base::openmode which, const Allocator& a);
|
| 108 |
```
|
| 109 |
|
| 110 |
*Effects:* Initializes the base class with
|
| 111 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 112 |
+
with
|
| 113 |
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::out, a)`
|
| 114 |
[[stringbuf.cons]].
|
| 115 |
|
| 116 |
``` cpp
|
| 117 |
explicit basic_ostringstream(
|
| 118 |
basic_string<charT, traits, Allocator>&& s,
|
| 119 |
ios_base::openmode which = ios_base::out);
|
| 120 |
```
|
| 121 |
|
| 122 |
*Effects:* Initializes the base class with
|
| 123 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 124 |
+
with
|
| 125 |
`basic_stringbuf<charT, traits, Allocator>(std::move(s), which | ios_base::out)`
|
| 126 |
[[stringbuf.cons]].
|
| 127 |
|
| 128 |
``` cpp
|
| 129 |
template<class SAlloc>
|
|
|
|
| 131 |
const basic_string<charT, traits, SAlloc>& s,
|
| 132 |
ios_base::openmode which, const Allocator& a);
|
| 133 |
```
|
| 134 |
|
| 135 |
*Effects:* Initializes the base class with
|
| 136 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 137 |
+
with
|
| 138 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out, a)`
|
| 139 |
[[stringbuf.cons]].
|
| 140 |
|
| 141 |
``` cpp
|
| 142 |
template<class SAlloc>
|
|
|
|
| 146 |
```
|
| 147 |
|
| 148 |
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 149 |
|
| 150 |
*Effects:* Initializes the base class with
|
| 151 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 152 |
+
with
|
| 153 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out)`
|
| 154 |
[[stringbuf.cons]].
|
| 155 |
|
| 156 |
+
``` cpp
|
| 157 |
+
template<class T>
|
| 158 |
+
explicit basic_ostringstream(const T& t, ios_base::openmode which = ios_base::out);
|
| 159 |
+
template<class T>
|
| 160 |
+
basic_ostringstream(const T& t, const Allocator& a);
|
| 161 |
+
template<class T>
|
| 162 |
+
basic_ostringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
Let `which` be `ios_base::out` for the overload with no parameter
|
| 166 |
+
`which`, and `a` be `Allocator()` for the overload with no parameter
|
| 167 |
+
`a`.
|
| 168 |
+
|
| 169 |
+
*Constraints:*
|
| 170 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 171 |
+
`true`.
|
| 172 |
+
|
| 173 |
+
*Effects:* Initializes the base class with `addressof(`*`sb`*`)`, and
|
| 174 |
+
direct-non-list-initializes *sb* with `t, which | ios_base::out, a`.
|
| 175 |
+
|
| 176 |
``` cpp
|
| 177 |
basic_ostringstream(basic_ostringstream&& rhs);
|
| 178 |
```
|
| 179 |
|
| 180 |
*Effects:* Move constructs from the rvalue `rhs`. This is accomplished
|
| 181 |
by move constructing the base class, and the contained
|
| 182 |
`basic_stringbuf`. Then calls
|
| 183 |
+
`basic_ostream<charT, traits>::set_rdbuf(addressof(`*`sb`*`))` to
|
| 184 |
+
install the contained `basic_stringbuf`.
|
| 185 |
|
| 186 |
#### Swap <a id="ostringstream.swap">[[ostringstream.swap]]</a>
|
| 187 |
|
| 188 |
``` cpp
|
| 189 |
void swap(basic_ostringstream& rhs);
|
|
|
|
| 200 |
template<class charT, class traits, class Allocator>
|
| 201 |
void swap(basic_ostringstream<charT, traits, Allocator>& x,
|
| 202 |
basic_ostringstream<charT, traits, Allocator>& y);
|
| 203 |
```
|
| 204 |
|
| 205 |
+
*Effects:* Equivalent to `x.swap(y)`.
|
| 206 |
|
| 207 |
#### Member functions <a id="ostringstream.members">[[ostringstream.members]]</a>
|
| 208 |
|
| 209 |
``` cpp
|
| 210 |
basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
| 211 |
```
|
| 212 |
|
| 213 |
*Returns:*
|
| 214 |
+
`const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(`*`sb`*`))`.
|
| 215 |
|
| 216 |
``` cpp
|
| 217 |
basic_string<charT, traits, Allocator> str() const &;
|
| 218 |
```
|
| 219 |
|
|
|
|
| 255 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 256 |
```
|
| 257 |
|
| 258 |
*Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
|
| 259 |
|
| 260 |
+
``` cpp
|
| 261 |
+
template<class T>
|
| 262 |
+
void str(const T& t);
|
| 263 |
+
```
|
| 264 |
+
|
| 265 |
+
*Constraints:*
|
| 266 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 267 |
+
`true`.
|
| 268 |
+
|
| 269 |
+
*Effects:* Equivalent to: `rdbuf()->str(t);`
|
| 270 |
+
|