- tmp/tmpbd72nqoc/{from.md → to.md} +290 -112
tmp/tmpbd72nqoc/{from.md → to.md}
RENAMED
|
@@ -2,45 +2,45 @@
|
|
| 2 |
|
| 3 |
### Header `<sstream>` synopsis <a id="sstream.syn">[[sstream.syn]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
-
|
| 8 |
-
|
| 9 |
class basic_stringbuf;
|
| 10 |
|
| 11 |
template<class charT, class traits, class Allocator>
|
| 12 |
void swap(basic_stringbuf<charT, traits, Allocator>& x,
|
| 13 |
basic_stringbuf<charT, traits, Allocator>& y) noexcept(noexcept(x.swap(y)));
|
| 14 |
|
| 15 |
using stringbuf = basic_stringbuf<char>;
|
| 16 |
using wstringbuf = basic_stringbuf<wchar_t>;
|
| 17 |
|
| 18 |
-
|
| 19 |
-
|
| 20 |
class basic_istringstream;
|
| 21 |
|
| 22 |
template<class charT, class traits, class Allocator>
|
| 23 |
void swap(basic_istringstream<charT, traits, Allocator>& x,
|
| 24 |
basic_istringstream<charT, traits, Allocator>& y);
|
| 25 |
|
| 26 |
using istringstream = basic_istringstream<char>;
|
| 27 |
using wistringstream = basic_istringstream<wchar_t>;
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
| 31 |
class basic_ostringstream;
|
| 32 |
|
| 33 |
template<class charT, class traits, class Allocator>
|
| 34 |
void swap(basic_ostringstream<charT, traits, Allocator>& x,
|
| 35 |
basic_ostringstream<charT, traits, Allocator>& y);
|
| 36 |
|
| 37 |
using ostringstream = basic_ostringstream<char>;
|
| 38 |
using wostringstream = basic_ostringstream<wchar_t>;
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
class basic_stringstream;
|
| 43 |
|
| 44 |
template<class charT, class traits, class Allocator>
|
| 45 |
void swap(basic_stringstream<charT, traits, Allocator>& x,
|
| 46 |
basic_stringstream<charT, traits, Allocator>& y);
|
|
@@ -58,18 +58,17 @@ described in [[string.classes]].
|
|
| 58 |
|
| 59 |
#### General <a id="stringbuf.general">[[stringbuf.general]]</a>
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
namespace std {
|
| 63 |
-
template<class charT, class traits = char_traits<charT>,
|
| 64 |
-
class Allocator = allocator<charT>>
|
| 65 |
class basic_stringbuf : public basic_streambuf<charT, traits> {
|
| 66 |
public:
|
| 67 |
using char_type = charT;
|
| 68 |
-
using int_type =
|
| 69 |
-
using pos_type =
|
| 70 |
-
using off_type =
|
| 71 |
using traits_type = traits;
|
| 72 |
using allocator_type = Allocator;
|
| 73 |
|
| 74 |
// [stringbuf.cons], constructors
|
| 75 |
basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {}
|
|
@@ -93,10 +92,17 @@ namespace std {
|
|
| 93 |
ios_base::openmode which, const Allocator& a);
|
| 94 |
template<class SAlloc>
|
| 95 |
explicit basic_stringbuf(
|
| 96 |
const basic_string<charT, traits, SAlloc>& s,
|
| 97 |
ios_base::openmode which = ios_base::in | ios_base::out);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
basic_stringbuf(const basic_stringbuf&) = delete;
|
| 99 |
basic_stringbuf(basic_stringbuf&& rhs);
|
| 100 |
basic_stringbuf(basic_stringbuf&& rhs, const Allocator& a);
|
| 101 |
|
| 102 |
// [stringbuf.assign], assignment and swap
|
|
@@ -115,10 +121,12 @@ namespace std {
|
|
| 115 |
|
| 116 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 117 |
template<class SAlloc>
|
| 118 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 119 |
void str(basic_string<charT, traits, Allocator>&& s);
|
|
|
|
|
|
|
| 120 |
|
| 121 |
protected:
|
| 122 |
// [stringbuf.virtuals], overridden virtual functions
|
| 123 |
int_type underflow() override;
|
| 124 |
int_type pbackfail(int_type c = traits::eof()) override;
|
|
@@ -133,11 +141,11 @@ namespace std {
|
|
| 133 |
= ios_base::in | ios_base::out) override;
|
| 134 |
|
| 135 |
private:
|
| 136 |
ios_base::openmode mode; // exposition only
|
| 137 |
basic_string<charT, traits, Allocator> buf; // exposition only
|
| 138 |
-
void
|
| 139 |
};
|
| 140 |
}
|
| 141 |
```
|
| 142 |
|
| 143 |
The class `basic_stringbuf` is derived from `basic_streambuf` to
|
|
@@ -151,22 +159,22 @@ initialization is presented here as:
|
|
| 151 |
|
| 152 |
- `ios_base::openmode mode`, has `in` set if the input sequence can be
|
| 153 |
read, and `out` set if the output sequence can be written.
|
| 154 |
- `basic_string<charT, traits, Allocator> buf` contains the underlying
|
| 155 |
character sequence.
|
| 156 |
-
- `
|
| 157 |
and put area [[streambuf.put.area]] pointers after initializing,
|
| 158 |
-
moving from, or assigning to `buf` accordingly.
|
| 159 |
|
| 160 |
#### Constructors <a id="stringbuf.cons">[[stringbuf.cons]]</a>
|
| 161 |
|
| 162 |
``` cpp
|
| 163 |
explicit basic_stringbuf(ios_base::openmode which);
|
| 164 |
```
|
| 165 |
|
| 166 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 167 |
-
[[streambuf.cons]], and
|
| 168 |
*implementation-defined* whether the sequence pointers (`eback()`,
|
| 169 |
`gptr()`, `egptr()`, `pbase()`, `pptr()`, `epptr()`) are initialized to
|
| 170 |
null pointers.
|
| 171 |
|
| 172 |
*Ensures:* `str().empty()` is `true`.
|
|
@@ -176,43 +184,43 @@ explicit basic_stringbuf(
|
|
| 176 |
const basic_string<charT, traits, Allocator>& s,
|
| 177 |
ios_base::openmode which = ios_base::in | ios_base::out);
|
| 178 |
```
|
| 179 |
|
| 180 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 181 |
-
[[streambuf.cons]],
|
| 182 |
-
`
|
| 183 |
|
| 184 |
``` cpp
|
| 185 |
basic_stringbuf(ios_base::openmode which, const Allocator& a);
|
| 186 |
```
|
| 187 |
|
| 188 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 189 |
-
[[streambuf.cons]],
|
| 190 |
-
`
|
| 191 |
|
| 192 |
*Ensures:* `str().empty()` is `true`.
|
| 193 |
|
| 194 |
``` cpp
|
| 195 |
explicit basic_stringbuf(
|
| 196 |
basic_string<charT, traits, Allocator>&& s,
|
| 197 |
ios_base::openmode which = ios_base::in | ios_base::out);
|
| 198 |
```
|
| 199 |
|
| 200 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 201 |
-
[[streambuf.cons]],
|
| 202 |
-
then calls `
|
| 203 |
|
| 204 |
``` cpp
|
| 205 |
template<class SAlloc>
|
| 206 |
basic_stringbuf(
|
| 207 |
const basic_string<charT, traits, SAlloc>& s,
|
| 208 |
ios_base::openmode which, const Allocator& a);
|
| 209 |
```
|
| 210 |
|
| 211 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 212 |
-
[[streambuf.cons]],
|
| 213 |
-
calls `
|
| 214 |
|
| 215 |
``` cpp
|
| 216 |
template<class SAlloc>
|
| 217 |
explicit basic_stringbuf(
|
| 218 |
const basic_string<charT, traits, SAlloc>& s,
|
|
@@ -220,21 +228,44 @@ template<class SAlloc>
|
|
| 220 |
```
|
| 221 |
|
| 222 |
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 223 |
|
| 224 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 225 |
-
[[streambuf.cons]],
|
| 226 |
-
`
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 227 |
|
| 228 |
``` cpp
|
| 229 |
basic_stringbuf(basic_stringbuf&& rhs);
|
| 230 |
basic_stringbuf(basic_stringbuf&& rhs, const Allocator& a);
|
| 231 |
```
|
| 232 |
|
| 233 |
*Effects:* Copy constructs the base class from `rhs` and initializes
|
| 234 |
-
|
| 235 |
-
`std::move(rhs).str()`. In the second form
|
| 236 |
`{std::move(rhs).str(), a}`. It is *implementation-defined* whether the
|
| 237 |
sequence pointers in `*this` (`eback()`, `gptr()`, `egptr()`, `pbase()`,
|
| 238 |
`pptr()`, `epptr()`) obtain the values which `rhs` had.
|
| 239 |
|
| 240 |
*Ensures:* Let `rhs_p` refer to the state of `rhs` just prior to this
|
|
@@ -277,19 +308,19 @@ void swap(basic_stringbuf& rhs) noexcept(see below);
|
|
| 277 |
|
| 278 |
*Effects:* Exchanges the state of `*this` and `rhs`.
|
| 279 |
|
| 280 |
*Remarks:* The exception specification is equivalent to:
|
| 281 |
`allocator_traits<Allocator>::propagate_on_container_swap::value ||`
|
| 282 |
-
`allocator_traits<Allocator>::is_always_equal::value`
|
| 283 |
|
| 284 |
``` cpp
|
| 285 |
template<class charT, class traits, class Allocator>
|
| 286 |
void swap(basic_stringbuf<charT, traits, Allocator>& x,
|
| 287 |
basic_stringbuf<charT, traits, Allocator>& y) noexcept(noexcept(x.swap(y)));
|
| 288 |
```
|
| 289 |
|
| 290 |
-
*Effects:* Equivalent to
|
| 291 |
|
| 292 |
#### Member functions <a id="stringbuf.members">[[stringbuf.members]]</a>
|
| 293 |
|
| 294 |
The member functions getting the underlying character sequence all refer
|
| 295 |
to a `high_mark` value, where `high_mark` represents the position one
|
|
@@ -300,39 +331,42 @@ of the `str` member functions passing a `basic_string` as an argument.
|
|
| 300 |
In the latter case, all characters initialized prior to the call are now
|
| 301 |
considered uninitialized (except for those characters re-initialized by
|
| 302 |
the new `basic_string`).
|
| 303 |
|
| 304 |
``` cpp
|
| 305 |
-
void
|
| 306 |
```
|
| 307 |
|
| 308 |
-
*Effects:* Initializes the input and output sequences from
|
| 309 |
-
according to
|
| 310 |
|
| 311 |
*Ensures:*
|
| 312 |
|
| 313 |
-
- If `ios_base::out` is set in
|
| 314 |
-
and `epptr() >= pbase() + buf.size()` is
|
| 315 |
-
|
| 316 |
-
|
|
|
|
| 317 |
- otherwise `pptr() == pbase()` is `true`.
|
| 318 |
-
- If `ios_base::in` is set in
|
| 319 |
-
|
|
|
|
| 320 |
`true`.
|
| 321 |
|
| 322 |
[*Note 1*: For efficiency reasons, stream buffer operations can violate
|
| 323 |
-
invariants of
|
| 324 |
`basic_stringbuf`, e.g., by writing to characters in the range
|
| 325 |
-
|
| 326 |
-
|
| 327 |
-
`basic_string`
|
|
|
|
| 328 |
|
| 329 |
``` cpp
|
| 330 |
allocator_type get_allocator() const noexcept;
|
| 331 |
```
|
| 332 |
|
| 333 |
-
*Returns:* `buf.get_allocator()`.
|
| 334 |
|
| 335 |
``` cpp
|
| 336 |
basic_string<charT, traits, Allocator> str() const &;
|
| 337 |
```
|
| 338 |
|
|
@@ -346,11 +380,11 @@ return basic_string<charT, traits, Allocator>(view(), get_allocator());
|
|
| 346 |
template<class SAlloc>
|
| 347 |
basic_string<charT, traits, SAlloc> str(const SAlloc& sa) const;
|
| 348 |
```
|
| 349 |
|
| 350 |
*Constraints:* `SAlloc` is a type that qualifies as an
|
| 351 |
-
allocator [[container.
|
| 352 |
|
| 353 |
*Effects:* Equivalent to:
|
| 354 |
|
| 355 |
``` cpp
|
| 356 |
return basic_string<charT, traits, SAlloc>(view(), sa);
|
|
@@ -360,11 +394,11 @@ return basic_string<charT, traits, SAlloc>(view(), sa);
|
|
| 360 |
basic_string<charT, traits, Allocator> str() &&;
|
| 361 |
```
|
| 362 |
|
| 363 |
*Ensures:* The underlying character sequence `buf` is empty and
|
| 364 |
`pbase()`, `pptr()`, `epptr()`, `eback()`, `gptr()`, and `egptr()` are
|
| 365 |
-
initialized as if by calling `
|
| 366 |
|
| 367 |
*Returns:* A `basic_string<charT, traits, Allocator>` object move
|
| 368 |
constructed from the `basic_stringbuf`’s underlying character sequence
|
| 369 |
in `buf`. This can be achieved by first adjusting `buf` to have the same
|
| 370 |
content as `view()`.
|
|
@@ -376,13 +410,13 @@ basic_string_view<charT, traits> view() const noexcept;
|
|
| 376 |
Let `sv` be `basic_string_view<charT, traits>`.
|
| 377 |
|
| 378 |
*Returns:* A `sv` object referring to the `basic_stringbuf`’s underlying
|
| 379 |
character sequence in `buf`:
|
| 380 |
|
| 381 |
-
- If `ios_base::out` is set in
|
| 382 |
`sv(pbase(), high_mark - pbase())` is returned.
|
| 383 |
-
- Otherwise, if `ios_base::in` is set in
|
| 384 |
`sv(eback(), egptr() - eback())` is returned.
|
| 385 |
- Otherwise, `sv()` is returned.
|
| 386 |
|
| 387 |
[*Note 2*: Using the returned `sv` object after destruction or
|
| 388 |
invalidation of the character sequence underlying `*this` is undefined
|
|
@@ -394,11 +428,11 @@ void str(const basic_string<charT, traits, Allocator>& s);
|
|
| 394 |
|
| 395 |
*Effects:* Equivalent to:
|
| 396 |
|
| 397 |
``` cpp
|
| 398 |
buf = s;
|
| 399 |
-
|
| 400 |
```
|
| 401 |
|
| 402 |
``` cpp
|
| 403 |
template<class SAlloc>
|
| 404 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
|
@@ -408,22 +442,39 @@ template<class SAlloc>
|
|
| 408 |
|
| 409 |
*Effects:* Equivalent to:
|
| 410 |
|
| 411 |
``` cpp
|
| 412 |
buf = s;
|
| 413 |
-
|
| 414 |
```
|
| 415 |
|
| 416 |
``` cpp
|
| 417 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 418 |
```
|
| 419 |
|
| 420 |
*Effects:* Equivalent to:
|
| 421 |
|
| 422 |
``` cpp
|
| 423 |
buf = std::move(s);
|
| 424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
```
|
| 426 |
|
| 427 |
#### Overridden virtual functions <a id="stringbuf.virtuals">[[stringbuf.virtuals]]</a>
|
| 428 |
|
| 429 |
``` cpp
|
|
@@ -445,11 +496,11 @@ sequence, if possible, in one of three ways:
|
|
| 445 |
- If `traits::eq_int_type(c, traits::eof())` returns `false` and if the
|
| 446 |
input sequence has a putback position available, and if
|
| 447 |
`traits::eq(to_char_type(c), gptr()[-1])` returns `true`, assigns
|
| 448 |
`gptr() - 1` to `gptr()`. Returns: `c`.
|
| 449 |
- If `traits::eq_int_type(c, traits::eof())` returns `false` and if the
|
| 450 |
-
input sequence has a putback position available, and if
|
| 451 |
`ios_base::out` is nonzero, assigns `c` to `*–gptr()`. Returns: `c`.
|
| 452 |
- If `traits::eq_int_type(c, traits::eof())` returns `true` and if the
|
| 453 |
input sequence has a putback position available, assigns `gptr() - 1`
|
| 454 |
to `gptr()`. Returns: `traits::not_eof(c)`.
|
| 455 |
|
|
@@ -477,14 +528,14 @@ sequence, if possible, in one of two ways:
|
|
| 477 |
|
| 478 |
*Remarks:* The function can alter the number of write positions
|
| 479 |
available as a result of any call.
|
| 480 |
|
| 481 |
The function can make a write position available only if `ios_base::out`
|
| 482 |
-
is set in
|
| 483 |
reallocates (or initially allocates) an array object with a sufficient
|
| 484 |
number of elements to hold the current array object (if any), plus at
|
| 485 |
-
least one additional write position. If `ios_base::in` is set in
|
| 486 |
the function alters the read end pointer `egptr()` to point just past
|
| 487 |
the new write position.
|
| 488 |
|
| 489 |
``` cpp
|
| 490 |
pos_type seekoff(off_type off, ios_base::seekdir way,
|
|
@@ -554,18 +605,17 @@ effect.
|
|
| 554 |
|
| 555 |
#### General <a id="istringstream.general">[[istringstream.general]]</a>
|
| 556 |
|
| 557 |
``` cpp
|
| 558 |
namespace std {
|
| 559 |
-
template<class charT, class traits = char_traits<charT>,
|
| 560 |
-
class Allocator = allocator<charT>>
|
| 561 |
class basic_istringstream : public basic_istream<charT, traits> {
|
| 562 |
public:
|
| 563 |
using char_type = charT;
|
| 564 |
-
using int_type =
|
| 565 |
-
using pos_type =
|
| 566 |
-
using off_type =
|
| 567 |
using traits_type = traits;
|
| 568 |
using allocator_type = Allocator;
|
| 569 |
|
| 570 |
// [istringstream.cons], constructors
|
| 571 |
basic_istringstream() : basic_istringstream(ios_base::in) {}
|
|
@@ -587,10 +637,16 @@ namespace std {
|
|
| 587 |
ios_base::openmode which, const Allocator& a);
|
| 588 |
template<class SAlloc>
|
| 589 |
explicit basic_istringstream(
|
| 590 |
const basic_string<charT, traits, SAlloc>& s,
|
| 591 |
ios_base::openmode which = ios_base::in);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 592 |
basic_istringstream(const basic_istringstream&) = delete;
|
| 593 |
basic_istringstream(basic_istringstream&& rhs);
|
| 594 |
|
| 595 |
basic_istringstream& operator=(const basic_istringstream&) = delete;
|
| 596 |
basic_istringstream& operator=(basic_istringstream&& rhs);
|
|
@@ -608,10 +664,12 @@ namespace std {
|
|
| 608 |
|
| 609 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 610 |
template<class SAlloc>
|
| 611 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 612 |
void str(basic_string<charT, traits, Allocator>&& s);
|
|
|
|
|
|
|
| 613 |
|
| 614 |
private:
|
| 615 |
basic_stringbuf<charT, traits, Allocator> sb; // exposition only
|
| 616 |
};
|
| 617 |
}
|
|
@@ -621,51 +679,54 @@ The class `basic_istringstream<charT, traits, Allocator>` supports
|
|
| 621 |
reading objects of class `basic_string<{}charT, traits, Allocator>`. It
|
| 622 |
uses a `basic_stringbuf<charT, traits, Allocator>` object to control the
|
| 623 |
associated storage. For the sake of exposition, the maintained data is
|
| 624 |
presented here as:
|
| 625 |
|
| 626 |
-
- `sb`, the `stringbuf` object.
|
| 627 |
|
| 628 |
#### Constructors <a id="istringstream.cons">[[istringstream.cons]]</a>
|
| 629 |
|
| 630 |
``` cpp
|
| 631 |
explicit basic_istringstream(ios_base::openmode which);
|
| 632 |
```
|
| 633 |
|
| 634 |
*Effects:* Initializes the base class with
|
| 635 |
-
`basic_istream<charT, traits>(addressof(sb))` [[istream]] and
|
| 636 |
-
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::in)`
|
| 637 |
[[stringbuf.cons]].
|
| 638 |
|
| 639 |
``` cpp
|
| 640 |
explicit basic_istringstream(
|
| 641 |
const basic_string<charT, traits, Allocator>& s,
|
| 642 |
ios_base::openmode which = ios_base::in);
|
| 643 |
```
|
| 644 |
|
| 645 |
*Effects:* Initializes the base class with
|
| 646 |
-
`basic_istream<charT, traits>(addressof(sb))` [[istream]] and
|
|
|
|
| 647 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::in)`
|
| 648 |
[[stringbuf.cons]].
|
| 649 |
|
| 650 |
``` cpp
|
| 651 |
basic_istringstream(ios_base::openmode which, const Allocator& a);
|
| 652 |
```
|
| 653 |
|
| 654 |
*Effects:* Initializes the base class with
|
| 655 |
-
`basic_istream<charT, traits>(addressof(sb))` [[istream]] and
|
|
|
|
| 656 |
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::in, a)`
|
| 657 |
[[stringbuf.cons]].
|
| 658 |
|
| 659 |
``` cpp
|
| 660 |
explicit basic_istringstream(
|
| 661 |
basic_string<charT, traits, Allocator>&& s,
|
| 662 |
ios_base::openmode which = ios_base::in);
|
| 663 |
```
|
| 664 |
|
| 665 |
*Effects:* Initializes the base class with
|
| 666 |
-
`basic_istream<charT, traits>(addressof(sb))` [[istream]] and
|
|
|
|
| 667 |
`basic_stringbuf<charT, traits, Allocator>(std::move(s), which | ios_base::in)`
|
| 668 |
[[stringbuf.cons]].
|
| 669 |
|
| 670 |
``` cpp
|
| 671 |
template<class SAlloc>
|
|
@@ -673,35 +734,59 @@ template<class SAlloc>
|
|
| 673 |
const basic_string<charT, traits, SAlloc>& s,
|
| 674 |
ios_base::openmode which, const Allocator& a);
|
| 675 |
```
|
| 676 |
|
| 677 |
*Effects:* Initializes the base class with
|
| 678 |
-
`basic_istream<charT, traits>(addressof(sb))` [[istream]] and
|
|
|
|
| 679 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::in, a)`
|
| 680 |
[[stringbuf.cons]].
|
| 681 |
|
| 682 |
``` cpp
|
| 683 |
template<class SAlloc>
|
| 684 |
explicit basic_istringstream(
|
| 685 |
const basic_string<charT, traits, SAlloc>& s,
|
| 686 |
ios_base::openmode which = ios_base::in);
|
| 687 |
```
|
| 688 |
|
|
|
|
|
|
|
| 689 |
*Effects:* Initializes the base class with
|
| 690 |
-
`basic_istream<charT, traits>(addressof(sb))` [[istream]] and
|
|
|
|
| 691 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::in)`
|
| 692 |
[[stringbuf.cons]].
|
| 693 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 694 |
``` cpp
|
| 695 |
basic_istringstream(basic_istringstream&& rhs);
|
| 696 |
```
|
| 697 |
|
| 698 |
*Effects:* Move constructs from the rvalue `rhs`. This is accomplished
|
| 699 |
by move constructing the base class, and the contained
|
| 700 |
`basic_stringbuf`. Then calls
|
| 701 |
-
`basic_istream<charT, traits>::set_rdbuf(addressof(sb))` to
|
| 702 |
-
contained `basic_stringbuf`.
|
| 703 |
|
| 704 |
#### Swap <a id="istringstream.swap">[[istringstream.swap]]</a>
|
| 705 |
|
| 706 |
``` cpp
|
| 707 |
void swap(basic_istringstream& rhs);
|
|
@@ -718,20 +803,20 @@ sb.swap(rhs.sb);
|
|
| 718 |
template<class charT, class traits, class Allocator>
|
| 719 |
void swap(basic_istringstream<charT, traits, Allocator>& x,
|
| 720 |
basic_istringstream<charT, traits, Allocator>& y);
|
| 721 |
```
|
| 722 |
|
| 723 |
-
*Effects:* Equivalent to
|
| 724 |
|
| 725 |
#### Member functions <a id="istringstream.members">[[istringstream.members]]</a>
|
| 726 |
|
| 727 |
``` cpp
|
| 728 |
basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
| 729 |
```
|
| 730 |
|
| 731 |
*Returns:*
|
| 732 |
-
`const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(sb))`.
|
| 733 |
|
| 734 |
``` cpp
|
| 735 |
basic_string<charT, traits, Allocator> str() const &;
|
| 736 |
```
|
| 737 |
|
|
@@ -773,24 +858,34 @@ template<class SAlloc>
|
|
| 773 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 774 |
```
|
| 775 |
|
| 776 |
*Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
|
| 777 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 778 |
### Class template `basic_ostringstream` <a id="ostringstream">[[ostringstream]]</a>
|
| 779 |
|
| 780 |
#### General <a id="ostringstream.general">[[ostringstream.general]]</a>
|
| 781 |
|
| 782 |
``` cpp
|
| 783 |
namespace std {
|
| 784 |
-
template<class charT, class traits = char_traits<charT>,
|
| 785 |
-
class Allocator = allocator<charT>>
|
| 786 |
class basic_ostringstream : public basic_ostream<charT, traits> {
|
| 787 |
public:
|
| 788 |
using char_type = charT;
|
| 789 |
-
using int_type =
|
| 790 |
-
using pos_type =
|
| 791 |
-
using off_type =
|
| 792 |
using traits_type = traits;
|
| 793 |
using allocator_type = Allocator;
|
| 794 |
|
| 795 |
// [ostringstream.cons], constructors
|
| 796 |
basic_ostringstream() : basic_ostringstream(ios_base::out) {}
|
|
@@ -812,10 +907,16 @@ namespace std {
|
|
| 812 |
ios_base::openmode which, const Allocator& a);
|
| 813 |
template<class SAlloc>
|
| 814 |
explicit basic_ostringstream(
|
| 815 |
const basic_string<charT, traits, SAlloc>& s,
|
| 816 |
ios_base::openmode which = ios_base::out);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 817 |
basic_ostringstream(const basic_ostringstream&) = delete;
|
| 818 |
basic_ostringstream(basic_ostringstream&& rhs);
|
| 819 |
|
| 820 |
basic_ostringstream& operator=(const basic_ostringstream&) = delete;
|
| 821 |
basic_ostringstream& operator=(basic_ostringstream&& rhs);
|
|
@@ -834,10 +935,12 @@ namespace std {
|
|
| 834 |
|
| 835 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 836 |
template<class SAlloc>
|
| 837 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 838 |
void str(basic_string<charT, traits, Allocator>&& s);
|
|
|
|
|
|
|
| 839 |
|
| 840 |
private:
|
| 841 |
basic_stringbuf<charT, traits, Allocator> sb; // exposition only
|
| 842 |
};
|
| 843 |
}
|
|
@@ -846,51 +949,54 @@ namespace std {
|
|
| 846 |
The class `basic_ostringstream<charT, traits, Allocator>` supports
|
| 847 |
writing objects of class `basic_string<{}charT, traits, Allocator>`. It
|
| 848 |
uses a `basic_stringbuf` object to control the associated storage. For
|
| 849 |
the sake of exposition, the maintained data is presented here as:
|
| 850 |
|
| 851 |
-
- `sb`, the `stringbuf` object.
|
| 852 |
|
| 853 |
#### Constructors <a id="ostringstream.cons">[[ostringstream.cons]]</a>
|
| 854 |
|
| 855 |
``` cpp
|
| 856 |
explicit basic_ostringstream(ios_base::openmode which);
|
| 857 |
```
|
| 858 |
|
| 859 |
*Effects:* Initializes the base class with
|
| 860 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
| 861 |
-
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::out)`
|
| 862 |
[[stringbuf.cons]].
|
| 863 |
|
| 864 |
``` cpp
|
| 865 |
explicit basic_ostringstream(
|
| 866 |
const basic_string<charT, traits, Allocator>& s,
|
| 867 |
ios_base::openmode which = ios_base::out);
|
| 868 |
```
|
| 869 |
|
| 870 |
*Effects:* Initializes the base class with
|
| 871 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 872 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out)`
|
| 873 |
[[stringbuf.cons]].
|
| 874 |
|
| 875 |
``` cpp
|
| 876 |
basic_ostringstream(ios_base::openmode which, const Allocator& a);
|
| 877 |
```
|
| 878 |
|
| 879 |
*Effects:* Initializes the base class with
|
| 880 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 881 |
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::out, a)`
|
| 882 |
[[stringbuf.cons]].
|
| 883 |
|
| 884 |
``` cpp
|
| 885 |
explicit basic_ostringstream(
|
| 886 |
basic_string<charT, traits, Allocator>&& s,
|
| 887 |
ios_base::openmode which = ios_base::out);
|
| 888 |
```
|
| 889 |
|
| 890 |
*Effects:* Initializes the base class with
|
| 891 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 892 |
`basic_stringbuf<charT, traits, Allocator>(std::move(s), which | ios_base::out)`
|
| 893 |
[[stringbuf.cons]].
|
| 894 |
|
| 895 |
``` cpp
|
| 896 |
template<class SAlloc>
|
|
@@ -898,11 +1004,12 @@ template<class SAlloc>
|
|
| 898 |
const basic_string<charT, traits, SAlloc>& s,
|
| 899 |
ios_base::openmode which, const Allocator& a);
|
| 900 |
```
|
| 901 |
|
| 902 |
*Effects:* Initializes the base class with
|
| 903 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 904 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out, a)`
|
| 905 |
[[stringbuf.cons]].
|
| 906 |
|
| 907 |
``` cpp
|
| 908 |
template<class SAlloc>
|
|
@@ -912,23 +1019,44 @@ template<class SAlloc>
|
|
| 912 |
```
|
| 913 |
|
| 914 |
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 915 |
|
| 916 |
*Effects:* Initializes the base class with
|
| 917 |
-
`basic_ostream<charT, traits>(addressof(sb))` [[ostream]] and
|
|
|
|
| 918 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out)`
|
| 919 |
[[stringbuf.cons]].
|
| 920 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 921 |
``` cpp
|
| 922 |
basic_ostringstream(basic_ostringstream&& rhs);
|
| 923 |
```
|
| 924 |
|
| 925 |
*Effects:* Move constructs from the rvalue `rhs`. This is accomplished
|
| 926 |
by move constructing the base class, and the contained
|
| 927 |
`basic_stringbuf`. Then calls
|
| 928 |
-
`basic_ostream<charT, traits>::set_rdbuf(addressof(sb))` to
|
| 929 |
-
contained `basic_stringbuf`.
|
| 930 |
|
| 931 |
#### Swap <a id="ostringstream.swap">[[ostringstream.swap]]</a>
|
| 932 |
|
| 933 |
``` cpp
|
| 934 |
void swap(basic_ostringstream& rhs);
|
|
@@ -945,20 +1073,20 @@ sb.swap(rhs.sb);
|
|
| 945 |
template<class charT, class traits, class Allocator>
|
| 946 |
void swap(basic_ostringstream<charT, traits, Allocator>& x,
|
| 947 |
basic_ostringstream<charT, traits, Allocator>& y);
|
| 948 |
```
|
| 949 |
|
| 950 |
-
*Effects:* Equivalent to
|
| 951 |
|
| 952 |
#### Member functions <a id="ostringstream.members">[[ostringstream.members]]</a>
|
| 953 |
|
| 954 |
``` cpp
|
| 955 |
basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
| 956 |
```
|
| 957 |
|
| 958 |
*Returns:*
|
| 959 |
-
`const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(sb))`.
|
| 960 |
|
| 961 |
``` cpp
|
| 962 |
basic_string<charT, traits, Allocator> str() const &;
|
| 963 |
```
|
| 964 |
|
|
@@ -1000,24 +1128,34 @@ template<class SAlloc>
|
|
| 1000 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 1001 |
```
|
| 1002 |
|
| 1003 |
*Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
|
| 1004 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1005 |
### Class template `basic_stringstream` <a id="stringstream">[[stringstream]]</a>
|
| 1006 |
|
| 1007 |
#### General <a id="stringstream.general">[[stringstream.general]]</a>
|
| 1008 |
|
| 1009 |
``` cpp
|
| 1010 |
namespace std {
|
| 1011 |
-
template<class charT, class traits = char_traits<charT>,
|
| 1012 |
-
class Allocator = allocator<charT>>
|
| 1013 |
class basic_stringstream : public basic_iostream<charT, traits> {
|
| 1014 |
public:
|
| 1015 |
using char_type = charT;
|
| 1016 |
-
using int_type =
|
| 1017 |
-
using pos_type =
|
| 1018 |
-
using off_type =
|
| 1019 |
using traits_type = traits;
|
| 1020 |
using allocator_type = Allocator;
|
| 1021 |
|
| 1022 |
// [stringstream.cons], constructors
|
| 1023 |
basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {}
|
|
@@ -1039,10 +1177,17 @@ namespace std {
|
|
| 1039 |
ios_base::openmode which, const Allocator& a);
|
| 1040 |
template<class SAlloc>
|
| 1041 |
explicit basic_stringstream(
|
| 1042 |
const basic_string<charT, traits, SAlloc>& s,
|
| 1043 |
ios_base::openmode which = ios_base::out | ios_base::in);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1044 |
basic_stringstream(const basic_stringstream&) = delete;
|
| 1045 |
basic_stringstream(basic_stringstream&& rhs);
|
| 1046 |
|
| 1047 |
basic_stringstream& operator=(const basic_stringstream&) = delete;
|
| 1048 |
basic_stringstream& operator=(basic_stringstream&& rhs);
|
|
@@ -1061,13 +1206,15 @@ namespace std {
|
|
| 1061 |
|
| 1062 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 1063 |
template<class SAlloc>
|
| 1064 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 1065 |
void str(basic_string<charT, traits, Allocator>&& s);
|
|
|
|
|
|
|
| 1066 |
|
| 1067 |
private:
|
| 1068 |
-
basic_stringbuf<charT, traits> sb;
|
| 1069 |
};
|
| 1070 |
}
|
| 1071 |
```
|
| 1072 |
|
| 1073 |
The class template `basic_stringstream<charT, traits>` supports reading
|
|
@@ -1075,50 +1222,50 @@ and writing from objects of class
|
|
| 1075 |
`basic_string<charT, traits, Allocator>`. It uses a
|
| 1076 |
`basic_stringbuf<charT, traits, Allocator>` object to control the
|
| 1077 |
associated sequence. For the sake of exposition, the maintained data is
|
| 1078 |
presented here as
|
| 1079 |
|
| 1080 |
-
- `sb`, the `stringbuf` object.
|
| 1081 |
|
| 1082 |
#### Constructors <a id="stringstream.cons">[[stringstream.cons]]</a>
|
| 1083 |
|
| 1084 |
``` cpp
|
| 1085 |
explicit basic_stringstream(ios_base::openmode which);
|
| 1086 |
```
|
| 1087 |
|
| 1088 |
*Effects:* Initializes the base class with
|
| 1089 |
-
`basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]]
|
| 1090 |
-
|
| 1091 |
|
| 1092 |
``` cpp
|
| 1093 |
explicit basic_stringstream(
|
| 1094 |
const basic_string<charT, traits, Allocator>& s,
|
| 1095 |
ios_base::openmode which = ios_base::out | ios_base::in);
|
| 1096 |
```
|
| 1097 |
|
| 1098 |
*Effects:* Initializes the base class with
|
| 1099 |
-
`basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]]
|
| 1100 |
-
|
| 1101 |
|
| 1102 |
``` cpp
|
| 1103 |
basic_stringstream(ios_base::openmode which, const Allocator& a);
|
| 1104 |
```
|
| 1105 |
|
| 1106 |
*Effects:* Initializes the base class with
|
| 1107 |
-
`basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]]
|
| 1108 |
-
|
| 1109 |
[[stringbuf.cons]].
|
| 1110 |
|
| 1111 |
``` cpp
|
| 1112 |
explicit basic_stringstream(
|
| 1113 |
basic_string<charT, traits, Allocator>&& s,
|
| 1114 |
ios_base::openmode which = ios_base::out | ios_base::in);
|
| 1115 |
```
|
| 1116 |
|
| 1117 |
*Effects:* Initializes the base class with
|
| 1118 |
-
`basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]]
|
| 1119 |
-
|
| 1120 |
`basic_stringbuf<charT, traits, Allocator>(std::move(s), which)`
|
| 1121 |
[[stringbuf.cons]].
|
| 1122 |
|
| 1123 |
``` cpp
|
| 1124 |
template<class SAlloc>
|
|
@@ -1126,12 +1273,12 @@ template<class SAlloc>
|
|
| 1126 |
const basic_string<charT, traits, SAlloc>& s,
|
| 1127 |
ios_base::openmode which, const Allocator& a);
|
| 1128 |
```
|
| 1129 |
|
| 1130 |
*Effects:* Initializes the base class with
|
| 1131 |
-
`basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]]
|
| 1132 |
-
|
| 1133 |
[[stringbuf.cons]].
|
| 1134 |
|
| 1135 |
``` cpp
|
| 1136 |
template<class SAlloc>
|
| 1137 |
explicit basic_stringstream(
|
|
@@ -1140,23 +1287,43 @@ template<class SAlloc>
|
|
| 1140 |
```
|
| 1141 |
|
| 1142 |
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 1143 |
|
| 1144 |
*Effects:* Initializes the base class with
|
| 1145 |
-
`basic_iostream<charT, traits>(addressof(sb))` [[iostream.cons]]
|
| 1146 |
-
|
| 1147 |
[[stringbuf.cons]].
|
| 1148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1149 |
``` cpp
|
| 1150 |
basic_stringstream(basic_stringstream&& rhs);
|
| 1151 |
```
|
| 1152 |
|
| 1153 |
*Effects:* Move constructs from the rvalue `rhs`. This is accomplished
|
| 1154 |
by move constructing the base class, and the contained
|
| 1155 |
`basic_stringbuf`. Then calls
|
| 1156 |
-
`basic_istream<charT, traits>::set_rdbuf(addressof(sb))` to
|
| 1157 |
-
contained `basic_stringbuf`.
|
| 1158 |
|
| 1159 |
#### Swap <a id="stringstream.swap">[[stringstream.swap]]</a>
|
| 1160 |
|
| 1161 |
``` cpp
|
| 1162 |
void swap(basic_stringstream& rhs);
|
|
@@ -1173,20 +1340,20 @@ sb.swap(rhs.sb);
|
|
| 1173 |
template<class charT, class traits, class Allocator>
|
| 1174 |
void swap(basic_stringstream<charT, traits, Allocator>& x,
|
| 1175 |
basic_stringstream<charT, traits, Allocator>& y);
|
| 1176 |
```
|
| 1177 |
|
| 1178 |
-
*Effects:* Equivalent to
|
| 1179 |
|
| 1180 |
#### Member functions <a id="stringstream.members">[[stringstream.members]]</a>
|
| 1181 |
|
| 1182 |
``` cpp
|
| 1183 |
basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
| 1184 |
```
|
| 1185 |
|
| 1186 |
*Returns:*
|
| 1187 |
-
`const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(sb))`.
|
| 1188 |
|
| 1189 |
``` cpp
|
| 1190 |
basic_string<charT, traits, Allocator> str() const &;
|
| 1191 |
```
|
| 1192 |
|
|
@@ -1228,5 +1395,16 @@ template<class SAlloc>
|
|
| 1228 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 1229 |
```
|
| 1230 |
|
| 1231 |
*Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
|
| 1232 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
### Header `<sstream>` synopsis <a id="sstream.syn">[[sstream.syn]]</a>
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
+
// [stringbuf], class template basic_stringbuf
|
| 8 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
| 9 |
class basic_stringbuf;
|
| 10 |
|
| 11 |
template<class charT, class traits, class Allocator>
|
| 12 |
void swap(basic_stringbuf<charT, traits, Allocator>& x,
|
| 13 |
basic_stringbuf<charT, traits, Allocator>& y) noexcept(noexcept(x.swap(y)));
|
| 14 |
|
| 15 |
using stringbuf = basic_stringbuf<char>;
|
| 16 |
using wstringbuf = basic_stringbuf<wchar_t>;
|
| 17 |
|
| 18 |
+
// [istringstream], class template basic_istringstream
|
| 19 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
| 20 |
class basic_istringstream;
|
| 21 |
|
| 22 |
template<class charT, class traits, class Allocator>
|
| 23 |
void swap(basic_istringstream<charT, traits, Allocator>& x,
|
| 24 |
basic_istringstream<charT, traits, Allocator>& y);
|
| 25 |
|
| 26 |
using istringstream = basic_istringstream<char>;
|
| 27 |
using wistringstream = basic_istringstream<wchar_t>;
|
| 28 |
|
| 29 |
+
// [ostringstream], class template basic_ostringstream
|
| 30 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
| 31 |
class basic_ostringstream;
|
| 32 |
|
| 33 |
template<class charT, class traits, class Allocator>
|
| 34 |
void swap(basic_ostringstream<charT, traits, Allocator>& x,
|
| 35 |
basic_ostringstream<charT, traits, Allocator>& y);
|
| 36 |
|
| 37 |
using ostringstream = basic_ostringstream<char>;
|
| 38 |
using wostringstream = basic_ostringstream<wchar_t>;
|
| 39 |
|
| 40 |
+
// [stringstream], class template basic_stringstream
|
| 41 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
| 42 |
class basic_stringstream;
|
| 43 |
|
| 44 |
template<class charT, class traits, class Allocator>
|
| 45 |
void swap(basic_stringstream<charT, traits, Allocator>& x,
|
| 46 |
basic_stringstream<charT, traits, Allocator>& y);
|
|
|
|
| 58 |
|
| 59 |
#### General <a id="stringbuf.general">[[stringbuf.general]]</a>
|
| 60 |
|
| 61 |
``` cpp
|
| 62 |
namespace std {
|
| 63 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
|
|
|
| 64 |
class basic_stringbuf : public basic_streambuf<charT, traits> {
|
| 65 |
public:
|
| 66 |
using char_type = charT;
|
| 67 |
+
using int_type = traits::int_type;
|
| 68 |
+
using pos_type = traits::pos_type;
|
| 69 |
+
using off_type = traits::off_type;
|
| 70 |
using traits_type = traits;
|
| 71 |
using allocator_type = Allocator;
|
| 72 |
|
| 73 |
// [stringbuf.cons], constructors
|
| 74 |
basic_stringbuf() : basic_stringbuf(ios_base::in | ios_base::out) {}
|
|
|
|
| 92 |
ios_base::openmode which, const Allocator& a);
|
| 93 |
template<class SAlloc>
|
| 94 |
explicit basic_stringbuf(
|
| 95 |
const basic_string<charT, traits, SAlloc>& s,
|
| 96 |
ios_base::openmode which = ios_base::in | ios_base::out);
|
| 97 |
+
template<class T>
|
| 98 |
+
explicit basic_stringbuf(const T& t,
|
| 99 |
+
ios_base::openmode which = ios_base::in | ios_base::out);
|
| 100 |
+
template<class T>
|
| 101 |
+
basic_stringbuf(const T& t, const Allocator& a);
|
| 102 |
+
template<class T>
|
| 103 |
+
basic_stringbuf(const T& t, ios_base::openmode which, const Allocator& a);
|
| 104 |
basic_stringbuf(const basic_stringbuf&) = delete;
|
| 105 |
basic_stringbuf(basic_stringbuf&& rhs);
|
| 106 |
basic_stringbuf(basic_stringbuf&& rhs, const Allocator& a);
|
| 107 |
|
| 108 |
// [stringbuf.assign], assignment and swap
|
|
|
|
| 121 |
|
| 122 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 123 |
template<class SAlloc>
|
| 124 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 125 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 126 |
+
template<class T>
|
| 127 |
+
void str(const T& t);
|
| 128 |
|
| 129 |
protected:
|
| 130 |
// [stringbuf.virtuals], overridden virtual functions
|
| 131 |
int_type underflow() override;
|
| 132 |
int_type pbackfail(int_type c = traits::eof()) override;
|
|
|
|
| 141 |
= ios_base::in | ios_base::out) override;
|
| 142 |
|
| 143 |
private:
|
| 144 |
ios_base::openmode mode; // exposition only
|
| 145 |
basic_string<charT, traits, Allocator> buf; // exposition only
|
| 146 |
+
void init-buf-ptrs(); // exposition only
|
| 147 |
};
|
| 148 |
}
|
| 149 |
```
|
| 150 |
|
| 151 |
The class `basic_stringbuf` is derived from `basic_streambuf` to
|
|
|
|
| 159 |
|
| 160 |
- `ios_base::openmode mode`, has `in` set if the input sequence can be
|
| 161 |
read, and `out` set if the output sequence can be written.
|
| 162 |
- `basic_string<charT, traits, Allocator> buf` contains the underlying
|
| 163 |
character sequence.
|
| 164 |
+
- `init-buf-ptrs()` sets the base class’ get area [[streambuf.get.area]]
|
| 165 |
and put area [[streambuf.put.area]] pointers after initializing,
|
| 166 |
+
moving from, or assigning to *`buf`* accordingly.
|
| 167 |
|
| 168 |
#### Constructors <a id="stringbuf.cons">[[stringbuf.cons]]</a>
|
| 169 |
|
| 170 |
``` cpp
|
| 171 |
explicit basic_stringbuf(ios_base::openmode which);
|
| 172 |
```
|
| 173 |
|
| 174 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 175 |
+
[[streambuf.cons]], and *mode* with `which`. It is
|
| 176 |
*implementation-defined* whether the sequence pointers (`eback()`,
|
| 177 |
`gptr()`, `egptr()`, `pbase()`, `pptr()`, `epptr()`) are initialized to
|
| 178 |
null pointers.
|
| 179 |
|
| 180 |
*Ensures:* `str().empty()` is `true`.
|
|
|
|
| 184 |
const basic_string<charT, traits, Allocator>& s,
|
| 185 |
ios_base::openmode which = ios_base::in | ios_base::out);
|
| 186 |
```
|
| 187 |
|
| 188 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 189 |
+
[[streambuf.cons]], *mode* with `which`, and *buf* with `s`, then calls
|
| 190 |
+
*`init-buf-ptrs`*`()`.
|
| 191 |
|
| 192 |
``` cpp
|
| 193 |
basic_stringbuf(ios_base::openmode which, const Allocator& a);
|
| 194 |
```
|
| 195 |
|
| 196 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 197 |
+
[[streambuf.cons]], *mode* with `which`, and *buf* with `a`, then calls
|
| 198 |
+
*`init-buf-ptrs`*`()`.
|
| 199 |
|
| 200 |
*Ensures:* `str().empty()` is `true`.
|
| 201 |
|
| 202 |
``` cpp
|
| 203 |
explicit basic_stringbuf(
|
| 204 |
basic_string<charT, traits, Allocator>&& s,
|
| 205 |
ios_base::openmode which = ios_base::in | ios_base::out);
|
| 206 |
```
|
| 207 |
|
| 208 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 209 |
+
[[streambuf.cons]], *mode* with `which`, and *buf* with `std::move(s)`,
|
| 210 |
+
then calls *`init-buf-ptrs`*`()`.
|
| 211 |
|
| 212 |
``` cpp
|
| 213 |
template<class SAlloc>
|
| 214 |
basic_stringbuf(
|
| 215 |
const basic_string<charT, traits, SAlloc>& s,
|
| 216 |
ios_base::openmode which, const Allocator& a);
|
| 217 |
```
|
| 218 |
|
| 219 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 220 |
+
[[streambuf.cons]], *mode* with `which`, and *buf* with `{s,a}`, then
|
| 221 |
+
calls *`init-buf-ptrs`*`()`.
|
| 222 |
|
| 223 |
``` cpp
|
| 224 |
template<class SAlloc>
|
| 225 |
explicit basic_stringbuf(
|
| 226 |
const basic_string<charT, traits, SAlloc>& s,
|
|
|
|
| 228 |
```
|
| 229 |
|
| 230 |
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 231 |
|
| 232 |
*Effects:* Initializes the base class with `basic_streambuf()`
|
| 233 |
+
[[streambuf.cons]], *mode* with `which`, and *buf* with `s`, then calls
|
| 234 |
+
*`init-buf-ptrs`*`()`.
|
| 235 |
+
|
| 236 |
+
``` cpp
|
| 237 |
+
template<class T>
|
| 238 |
+
explicit basic_stringbuf(const T& t, ios_base::openmode which = ios_base::in | ios_base::out);
|
| 239 |
+
template<class T>
|
| 240 |
+
basic_stringbuf(const T& t, const Allocator& a);
|
| 241 |
+
template<class T>
|
| 242 |
+
basic_stringbuf(const T& t, ios_base::openmode which, const Allocator& a);
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
+
Let `which` be `ios_base::in | ios_base::out` for the overload with no
|
| 246 |
+
parameter `which`, and `a` be `Allocator()` for the overload with no
|
| 247 |
+
parameter `a`.
|
| 248 |
+
|
| 249 |
+
*Constraints:*
|
| 250 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 251 |
+
`true`.
|
| 252 |
+
|
| 253 |
+
*Effects:* Creates a variable `sv` as if by
|
| 254 |
+
`basic_string_view<charT, traits> sv = t`, then value-initializes the
|
| 255 |
+
base class, initializes *mode* with `which`, and
|
| 256 |
+
direct-non-list-initializes *buf* with `sv, a`, then calls
|
| 257 |
+
*`init-buf-ptrs`*`()`.
|
| 258 |
|
| 259 |
``` cpp
|
| 260 |
basic_stringbuf(basic_stringbuf&& rhs);
|
| 261 |
basic_stringbuf(basic_stringbuf&& rhs, const Allocator& a);
|
| 262 |
```
|
| 263 |
|
| 264 |
*Effects:* Copy constructs the base class from `rhs` and initializes
|
| 265 |
+
*mode* with `rhs.mode`. In the first form `buf` is initialized from
|
| 266 |
+
`std::move(rhs).str()`. In the second form *buf* is initialized from
|
| 267 |
`{std::move(rhs).str(), a}`. It is *implementation-defined* whether the
|
| 268 |
sequence pointers in `*this` (`eback()`, `gptr()`, `egptr()`, `pbase()`,
|
| 269 |
`pptr()`, `epptr()`) obtain the values which `rhs` had.
|
| 270 |
|
| 271 |
*Ensures:* Let `rhs_p` refer to the state of `rhs` just prior to this
|
|
|
|
| 308 |
|
| 309 |
*Effects:* Exchanges the state of `*this` and `rhs`.
|
| 310 |
|
| 311 |
*Remarks:* The exception specification is equivalent to:
|
| 312 |
`allocator_traits<Allocator>::propagate_on_container_swap::value ||`
|
| 313 |
+
`allocator_traits<Allocator>::is_always_equal::value`
|
| 314 |
|
| 315 |
``` cpp
|
| 316 |
template<class charT, class traits, class Allocator>
|
| 317 |
void swap(basic_stringbuf<charT, traits, Allocator>& x,
|
| 318 |
basic_stringbuf<charT, traits, Allocator>& y) noexcept(noexcept(x.swap(y)));
|
| 319 |
```
|
| 320 |
|
| 321 |
+
*Effects:* Equivalent to `x.swap(y)`.
|
| 322 |
|
| 323 |
#### Member functions <a id="stringbuf.members">[[stringbuf.members]]</a>
|
| 324 |
|
| 325 |
The member functions getting the underlying character sequence all refer
|
| 326 |
to a `high_mark` value, where `high_mark` represents the position one
|
|
|
|
| 331 |
In the latter case, all characters initialized prior to the call are now
|
| 332 |
considered uninitialized (except for those characters re-initialized by
|
| 333 |
the new `basic_string`).
|
| 334 |
|
| 335 |
``` cpp
|
| 336 |
+
void init-buf-ptrs();
|
| 337 |
```
|
| 338 |
|
| 339 |
+
*Effects:* Initializes the input and output sequences from *buf*
|
| 340 |
+
according to *mode*.
|
| 341 |
|
| 342 |
*Ensures:*
|
| 343 |
|
| 344 |
+
- If `ios_base::out` is set in *mode*, `pbase()` points to
|
| 345 |
+
*`buf`*`.front()` and `epptr() >= pbase() + `*`buf`*`.size()` is
|
| 346 |
+
`true`;
|
| 347 |
+
- in addition, if `ios_base::ate` is set in *mode*,
|
| 348 |
+
`pptr() == pbase() + `*`buf`*`.size()` is `true`,
|
| 349 |
- otherwise `pptr() == pbase()` is `true`.
|
| 350 |
+
- If `ios_base::in` is set in *mode*, `eback()` points to
|
| 351 |
+
*`buf`*`.front()`, and
|
| 352 |
+
`(gptr() == eback() && egptr() == eback() + `*`buf`*`.size())` is
|
| 353 |
`true`.
|
| 354 |
|
| 355 |
[*Note 1*: For efficiency reasons, stream buffer operations can violate
|
| 356 |
+
invariants of *buf* while it is held encapsulated in the
|
| 357 |
`basic_stringbuf`, e.g., by writing to characters in the range
|
| 358 |
+
[*`buf`*`.data() + `*`buf`*`.size()`,
|
| 359 |
+
*`buf`*`.data() + `*`buf`*`.capacity()`). All operations retrieving a
|
| 360 |
+
`basic_string` from `buf` ensure that the `basic_string` invariants hold
|
| 361 |
+
on the returned value. — *end note*]
|
| 362 |
|
| 363 |
``` cpp
|
| 364 |
allocator_type get_allocator() const noexcept;
|
| 365 |
```
|
| 366 |
|
| 367 |
+
*Returns:* *`buf`*`.get_allocator()`.
|
| 368 |
|
| 369 |
``` cpp
|
| 370 |
basic_string<charT, traits, Allocator> str() const &;
|
| 371 |
```
|
| 372 |
|
|
|
|
| 380 |
template<class SAlloc>
|
| 381 |
basic_string<charT, traits, SAlloc> str(const SAlloc& sa) const;
|
| 382 |
```
|
| 383 |
|
| 384 |
*Constraints:* `SAlloc` is a type that qualifies as an
|
| 385 |
+
allocator [[container.reqmts]].
|
| 386 |
|
| 387 |
*Effects:* Equivalent to:
|
| 388 |
|
| 389 |
``` cpp
|
| 390 |
return basic_string<charT, traits, SAlloc>(view(), sa);
|
|
|
|
| 394 |
basic_string<charT, traits, Allocator> str() &&;
|
| 395 |
```
|
| 396 |
|
| 397 |
*Ensures:* The underlying character sequence `buf` is empty and
|
| 398 |
`pbase()`, `pptr()`, `epptr()`, `eback()`, `gptr()`, and `egptr()` are
|
| 399 |
+
initialized as if by calling *`init-buf-ptrs`*`()` with an empty `buf`.
|
| 400 |
|
| 401 |
*Returns:* A `basic_string<charT, traits, Allocator>` object move
|
| 402 |
constructed from the `basic_stringbuf`’s underlying character sequence
|
| 403 |
in `buf`. This can be achieved by first adjusting `buf` to have the same
|
| 404 |
content as `view()`.
|
|
|
|
| 410 |
Let `sv` be `basic_string_view<charT, traits>`.
|
| 411 |
|
| 412 |
*Returns:* A `sv` object referring to the `basic_stringbuf`’s underlying
|
| 413 |
character sequence in `buf`:
|
| 414 |
|
| 415 |
+
- If `ios_base::out` is set in *mode*, then
|
| 416 |
`sv(pbase(), high_mark - pbase())` is returned.
|
| 417 |
+
- Otherwise, if `ios_base::in` is set in *mode*, then
|
| 418 |
`sv(eback(), egptr() - eback())` is returned.
|
| 419 |
- Otherwise, `sv()` is returned.
|
| 420 |
|
| 421 |
[*Note 2*: Using the returned `sv` object after destruction or
|
| 422 |
invalidation of the character sequence underlying `*this` is undefined
|
|
|
|
| 428 |
|
| 429 |
*Effects:* Equivalent to:
|
| 430 |
|
| 431 |
``` cpp
|
| 432 |
buf = s;
|
| 433 |
+
init-buf-ptrs();
|
| 434 |
```
|
| 435 |
|
| 436 |
``` cpp
|
| 437 |
template<class SAlloc>
|
| 438 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
|
|
|
| 442 |
|
| 443 |
*Effects:* Equivalent to:
|
| 444 |
|
| 445 |
``` cpp
|
| 446 |
buf = s;
|
| 447 |
+
init-buf-ptrs();
|
| 448 |
```
|
| 449 |
|
| 450 |
``` cpp
|
| 451 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 452 |
```
|
| 453 |
|
| 454 |
*Effects:* Equivalent to:
|
| 455 |
|
| 456 |
``` cpp
|
| 457 |
buf = std::move(s);
|
| 458 |
+
init-buf-ptrs();
|
| 459 |
+
```
|
| 460 |
+
|
| 461 |
+
``` cpp
|
| 462 |
+
template<class T>
|
| 463 |
+
void str(const T& t);
|
| 464 |
+
```
|
| 465 |
+
|
| 466 |
+
*Constraints:*
|
| 467 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 468 |
+
`true`.
|
| 469 |
+
|
| 470 |
+
*Effects:* Equivalent to:
|
| 471 |
+
|
| 472 |
+
``` cpp
|
| 473 |
+
basic_string_view<charT, traits> sv = t;
|
| 474 |
+
buf = sv;
|
| 475 |
+
init-buf-ptrs();
|
| 476 |
```
|
| 477 |
|
| 478 |
#### Overridden virtual functions <a id="stringbuf.virtuals">[[stringbuf.virtuals]]</a>
|
| 479 |
|
| 480 |
``` cpp
|
|
|
|
| 496 |
- If `traits::eq_int_type(c, traits::eof())` returns `false` and if the
|
| 497 |
input sequence has a putback position available, and if
|
| 498 |
`traits::eq(to_char_type(c), gptr()[-1])` returns `true`, assigns
|
| 499 |
`gptr() - 1` to `gptr()`. Returns: `c`.
|
| 500 |
- If `traits::eq_int_type(c, traits::eof())` returns `false` and if the
|
| 501 |
+
input sequence has a putback position available, and if *mode* `&`
|
| 502 |
`ios_base::out` is nonzero, assigns `c` to `*–gptr()`. Returns: `c`.
|
| 503 |
- If `traits::eq_int_type(c, traits::eof())` returns `true` and if the
|
| 504 |
input sequence has a putback position available, assigns `gptr() - 1`
|
| 505 |
to `gptr()`. Returns: `traits::not_eof(c)`.
|
| 506 |
|
|
|
|
| 528 |
|
| 529 |
*Remarks:* The function can alter the number of write positions
|
| 530 |
available as a result of any call.
|
| 531 |
|
| 532 |
The function can make a write position available only if `ios_base::out`
|
| 533 |
+
is set in *mode*. To make a write position available, the function
|
| 534 |
reallocates (or initially allocates) an array object with a sufficient
|
| 535 |
number of elements to hold the current array object (if any), plus at
|
| 536 |
+
least one additional write position. If `ios_base::in` is set in *mode*,
|
| 537 |
the function alters the read end pointer `egptr()` to point just past
|
| 538 |
the new write position.
|
| 539 |
|
| 540 |
``` cpp
|
| 541 |
pos_type seekoff(off_type off, ios_base::seekdir way,
|
|
|
|
| 605 |
|
| 606 |
#### General <a id="istringstream.general">[[istringstream.general]]</a>
|
| 607 |
|
| 608 |
``` cpp
|
| 609 |
namespace std {
|
| 610 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
|
|
|
| 611 |
class basic_istringstream : public basic_istream<charT, traits> {
|
| 612 |
public:
|
| 613 |
using char_type = charT;
|
| 614 |
+
using int_type = traits::int_type;
|
| 615 |
+
using pos_type = traits::pos_type;
|
| 616 |
+
using off_type = traits::off_type;
|
| 617 |
using traits_type = traits;
|
| 618 |
using allocator_type = Allocator;
|
| 619 |
|
| 620 |
// [istringstream.cons], constructors
|
| 621 |
basic_istringstream() : basic_istringstream(ios_base::in) {}
|
|
|
|
| 637 |
ios_base::openmode which, const Allocator& a);
|
| 638 |
template<class SAlloc>
|
| 639 |
explicit basic_istringstream(
|
| 640 |
const basic_string<charT, traits, SAlloc>& s,
|
| 641 |
ios_base::openmode which = ios_base::in);
|
| 642 |
+
template<class T>
|
| 643 |
+
explicit basic_istringstream(const T& t, ios_base::openmode which = ios_base::in);
|
| 644 |
+
template<class T>
|
| 645 |
+
basic_istringstream(const T& t, const Allocator& a);
|
| 646 |
+
template<class T>
|
| 647 |
+
basic_istringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
| 648 |
basic_istringstream(const basic_istringstream&) = delete;
|
| 649 |
basic_istringstream(basic_istringstream&& rhs);
|
| 650 |
|
| 651 |
basic_istringstream& operator=(const basic_istringstream&) = delete;
|
| 652 |
basic_istringstream& operator=(basic_istringstream&& rhs);
|
|
|
|
| 664 |
|
| 665 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 666 |
template<class SAlloc>
|
| 667 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 668 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 669 |
+
template<class T>
|
| 670 |
+
void str(const T& t);
|
| 671 |
|
| 672 |
private:
|
| 673 |
basic_stringbuf<charT, traits, Allocator> sb; // exposition only
|
| 674 |
};
|
| 675 |
}
|
|
|
|
| 679 |
reading objects of class `basic_string<{}charT, traits, Allocator>`. It
|
| 680 |
uses a `basic_stringbuf<charT, traits, Allocator>` object to control the
|
| 681 |
associated storage. For the sake of exposition, the maintained data is
|
| 682 |
presented here as:
|
| 683 |
|
| 684 |
+
- *`sb`*, the `stringbuf` object.
|
| 685 |
|
| 686 |
#### Constructors <a id="istringstream.cons">[[istringstream.cons]]</a>
|
| 687 |
|
| 688 |
``` cpp
|
| 689 |
explicit basic_istringstream(ios_base::openmode which);
|
| 690 |
```
|
| 691 |
|
| 692 |
*Effects:* Initializes the base class with
|
| 693 |
+
`basic_istream<charT, traits>(addressof(`*`sb`*`))` [[istream]] and *sb*
|
| 694 |
+
with `basic_stringbuf<charT, traits, Allocator>(which | ios_base::in)`
|
| 695 |
[[stringbuf.cons]].
|
| 696 |
|
| 697 |
``` cpp
|
| 698 |
explicit basic_istringstream(
|
| 699 |
const basic_string<charT, traits, Allocator>& s,
|
| 700 |
ios_base::openmode which = ios_base::in);
|
| 701 |
```
|
| 702 |
|
| 703 |
*Effects:* Initializes the base class with
|
| 704 |
+
`basic_istream<charT, traits>(addressof(`*`sb`*`))` [[istream]] and *sb*
|
| 705 |
+
with
|
| 706 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::in)`
|
| 707 |
[[stringbuf.cons]].
|
| 708 |
|
| 709 |
``` cpp
|
| 710 |
basic_istringstream(ios_base::openmode which, const Allocator& a);
|
| 711 |
```
|
| 712 |
|
| 713 |
*Effects:* Initializes the base class with
|
| 714 |
+
`basic_istream<charT, traits>(addressof(`*`sb`*`))` [[istream]] and *sb*
|
| 715 |
+
with
|
| 716 |
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::in, a)`
|
| 717 |
[[stringbuf.cons]].
|
| 718 |
|
| 719 |
``` cpp
|
| 720 |
explicit basic_istringstream(
|
| 721 |
basic_string<charT, traits, Allocator>&& s,
|
| 722 |
ios_base::openmode which = ios_base::in);
|
| 723 |
```
|
| 724 |
|
| 725 |
*Effects:* Initializes the base class with
|
| 726 |
+
`basic_istream<charT, traits>(addressof(`*`sb`*`))` [[istream]] and *sb*
|
| 727 |
+
with
|
| 728 |
`basic_stringbuf<charT, traits, Allocator>(std::move(s), which | ios_base::in)`
|
| 729 |
[[stringbuf.cons]].
|
| 730 |
|
| 731 |
``` cpp
|
| 732 |
template<class SAlloc>
|
|
|
|
| 734 |
const basic_string<charT, traits, SAlloc>& s,
|
| 735 |
ios_base::openmode which, const Allocator& a);
|
| 736 |
```
|
| 737 |
|
| 738 |
*Effects:* Initializes the base class with
|
| 739 |
+
`basic_istream<charT, traits>(addressof(`*`sb`*`))` [[istream]] and *sb*
|
| 740 |
+
with
|
| 741 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::in, a)`
|
| 742 |
[[stringbuf.cons]].
|
| 743 |
|
| 744 |
``` cpp
|
| 745 |
template<class SAlloc>
|
| 746 |
explicit basic_istringstream(
|
| 747 |
const basic_string<charT, traits, SAlloc>& s,
|
| 748 |
ios_base::openmode which = ios_base::in);
|
| 749 |
```
|
| 750 |
|
| 751 |
+
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 752 |
+
|
| 753 |
*Effects:* Initializes the base class with
|
| 754 |
+
`basic_istream<charT, traits>(addressof(`*`sb`*`))` [[istream]] and *sb*
|
| 755 |
+
with
|
| 756 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::in)`
|
| 757 |
[[stringbuf.cons]].
|
| 758 |
|
| 759 |
+
``` cpp
|
| 760 |
+
template<class T>
|
| 761 |
+
explicit basic_istringstream(const T& t, ios_base::openmode which = ios_base::in);
|
| 762 |
+
template<class T>
|
| 763 |
+
basic_istringstream(const T& t, const Allocator& a);
|
| 764 |
+
template<class T>
|
| 765 |
+
basic_istringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
| 766 |
+
```
|
| 767 |
+
|
| 768 |
+
Let `which` be `ios_base::in` for the overload with no parameter
|
| 769 |
+
`which`, and `a` be `Allocator()` for the overload with no parameter
|
| 770 |
+
`a`.
|
| 771 |
+
|
| 772 |
+
*Constraints:*
|
| 773 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 774 |
+
`true`.
|
| 775 |
+
|
| 776 |
+
*Effects:* Initializes the base class with `addressof(`*`sb`*`)`, and
|
| 777 |
+
direct-non-list-initializes *sb* with `t, which | ios_base::in, a`.
|
| 778 |
+
|
| 779 |
``` cpp
|
| 780 |
basic_istringstream(basic_istringstream&& rhs);
|
| 781 |
```
|
| 782 |
|
| 783 |
*Effects:* Move constructs from the rvalue `rhs`. This is accomplished
|
| 784 |
by move constructing the base class, and the contained
|
| 785 |
`basic_stringbuf`. Then calls
|
| 786 |
+
`basic_istream<charT, traits>::set_rdbuf(addressof(`*`sb`*`))` to
|
| 787 |
+
install the contained `basic_stringbuf`.
|
| 788 |
|
| 789 |
#### Swap <a id="istringstream.swap">[[istringstream.swap]]</a>
|
| 790 |
|
| 791 |
``` cpp
|
| 792 |
void swap(basic_istringstream& rhs);
|
|
|
|
| 803 |
template<class charT, class traits, class Allocator>
|
| 804 |
void swap(basic_istringstream<charT, traits, Allocator>& x,
|
| 805 |
basic_istringstream<charT, traits, Allocator>& y);
|
| 806 |
```
|
| 807 |
|
| 808 |
+
*Effects:* Equivalent to `x.swap(y)`.
|
| 809 |
|
| 810 |
#### Member functions <a id="istringstream.members">[[istringstream.members]]</a>
|
| 811 |
|
| 812 |
``` cpp
|
| 813 |
basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
| 814 |
```
|
| 815 |
|
| 816 |
*Returns:*
|
| 817 |
+
`const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(`*`sb`*`))`.
|
| 818 |
|
| 819 |
``` cpp
|
| 820 |
basic_string<charT, traits, Allocator> str() const &;
|
| 821 |
```
|
| 822 |
|
|
|
|
| 858 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 859 |
```
|
| 860 |
|
| 861 |
*Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
|
| 862 |
|
| 863 |
+
``` cpp
|
| 864 |
+
template<class T>
|
| 865 |
+
void str(const T& t);
|
| 866 |
+
```
|
| 867 |
+
|
| 868 |
+
*Constraints:*
|
| 869 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 870 |
+
`true`.
|
| 871 |
+
|
| 872 |
+
*Effects:* Equivalent to: `rdbuf()->str(t);`
|
| 873 |
+
|
| 874 |
### Class template `basic_ostringstream` <a id="ostringstream">[[ostringstream]]</a>
|
| 875 |
|
| 876 |
#### General <a id="ostringstream.general">[[ostringstream.general]]</a>
|
| 877 |
|
| 878 |
``` cpp
|
| 879 |
namespace std {
|
| 880 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
|
|
|
| 881 |
class basic_ostringstream : public basic_ostream<charT, traits> {
|
| 882 |
public:
|
| 883 |
using char_type = charT;
|
| 884 |
+
using int_type = traits::int_type;
|
| 885 |
+
using pos_type = traits::pos_type;
|
| 886 |
+
using off_type = traits::off_type;
|
| 887 |
using traits_type = traits;
|
| 888 |
using allocator_type = Allocator;
|
| 889 |
|
| 890 |
// [ostringstream.cons], constructors
|
| 891 |
basic_ostringstream() : basic_ostringstream(ios_base::out) {}
|
|
|
|
| 907 |
ios_base::openmode which, const Allocator& a);
|
| 908 |
template<class SAlloc>
|
| 909 |
explicit basic_ostringstream(
|
| 910 |
const basic_string<charT, traits, SAlloc>& s,
|
| 911 |
ios_base::openmode which = ios_base::out);
|
| 912 |
+
template<class T>
|
| 913 |
+
explicit basic_ostringstream(const T& t, ios_base::openmode which = ios_base::out);
|
| 914 |
+
template<class T>
|
| 915 |
+
basic_ostringstream(const T& t, const Allocator& a);
|
| 916 |
+
template<class T>
|
| 917 |
+
basic_ostringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
| 918 |
basic_ostringstream(const basic_ostringstream&) = delete;
|
| 919 |
basic_ostringstream(basic_ostringstream&& rhs);
|
| 920 |
|
| 921 |
basic_ostringstream& operator=(const basic_ostringstream&) = delete;
|
| 922 |
basic_ostringstream& operator=(basic_ostringstream&& rhs);
|
|
|
|
| 935 |
|
| 936 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 937 |
template<class SAlloc>
|
| 938 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 939 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 940 |
+
template<class T>
|
| 941 |
+
void str(const T& t);
|
| 942 |
|
| 943 |
private:
|
| 944 |
basic_stringbuf<charT, traits, Allocator> sb; // exposition only
|
| 945 |
};
|
| 946 |
}
|
|
|
|
| 949 |
The class `basic_ostringstream<charT, traits, Allocator>` supports
|
| 950 |
writing objects of class `basic_string<{}charT, traits, Allocator>`. It
|
| 951 |
uses a `basic_stringbuf` object to control the associated storage. For
|
| 952 |
the sake of exposition, the maintained data is presented here as:
|
| 953 |
|
| 954 |
+
- *`sb`*, the `stringbuf` object.
|
| 955 |
|
| 956 |
#### Constructors <a id="ostringstream.cons">[[ostringstream.cons]]</a>
|
| 957 |
|
| 958 |
``` cpp
|
| 959 |
explicit basic_ostringstream(ios_base::openmode which);
|
| 960 |
```
|
| 961 |
|
| 962 |
*Effects:* Initializes the base class with
|
| 963 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 964 |
+
with `basic_stringbuf<charT, traits, Allocator>(which | ios_base::out)`
|
| 965 |
[[stringbuf.cons]].
|
| 966 |
|
| 967 |
``` cpp
|
| 968 |
explicit basic_ostringstream(
|
| 969 |
const basic_string<charT, traits, Allocator>& s,
|
| 970 |
ios_base::openmode which = ios_base::out);
|
| 971 |
```
|
| 972 |
|
| 973 |
*Effects:* Initializes the base class with
|
| 974 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 975 |
+
with
|
| 976 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out)`
|
| 977 |
[[stringbuf.cons]].
|
| 978 |
|
| 979 |
``` cpp
|
| 980 |
basic_ostringstream(ios_base::openmode which, const Allocator& a);
|
| 981 |
```
|
| 982 |
|
| 983 |
*Effects:* Initializes the base class with
|
| 984 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 985 |
+
with
|
| 986 |
`basic_stringbuf<charT, traits, Allocator>(which | ios_base::out, a)`
|
| 987 |
[[stringbuf.cons]].
|
| 988 |
|
| 989 |
``` cpp
|
| 990 |
explicit basic_ostringstream(
|
| 991 |
basic_string<charT, traits, Allocator>&& s,
|
| 992 |
ios_base::openmode which = ios_base::out);
|
| 993 |
```
|
| 994 |
|
| 995 |
*Effects:* Initializes the base class with
|
| 996 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 997 |
+
with
|
| 998 |
`basic_stringbuf<charT, traits, Allocator>(std::move(s), which | ios_base::out)`
|
| 999 |
[[stringbuf.cons]].
|
| 1000 |
|
| 1001 |
``` cpp
|
| 1002 |
template<class SAlloc>
|
|
|
|
| 1004 |
const basic_string<charT, traits, SAlloc>& s,
|
| 1005 |
ios_base::openmode which, const Allocator& a);
|
| 1006 |
```
|
| 1007 |
|
| 1008 |
*Effects:* Initializes the base class with
|
| 1009 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 1010 |
+
with
|
| 1011 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out, a)`
|
| 1012 |
[[stringbuf.cons]].
|
| 1013 |
|
| 1014 |
``` cpp
|
| 1015 |
template<class SAlloc>
|
|
|
|
| 1019 |
```
|
| 1020 |
|
| 1021 |
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 1022 |
|
| 1023 |
*Effects:* Initializes the base class with
|
| 1024 |
+
`basic_ostream<charT, traits>(addressof(`*`sb`*`))` [[ostream]] and *sb*
|
| 1025 |
+
with
|
| 1026 |
`basic_stringbuf<charT, traits, Allocator>(s, which | ios_base::out)`
|
| 1027 |
[[stringbuf.cons]].
|
| 1028 |
|
| 1029 |
+
``` cpp
|
| 1030 |
+
template<class T>
|
| 1031 |
+
explicit basic_ostringstream(const T& t, ios_base::openmode which = ios_base::out);
|
| 1032 |
+
template<class T>
|
| 1033 |
+
basic_ostringstream(const T& t, const Allocator& a);
|
| 1034 |
+
template<class T>
|
| 1035 |
+
basic_ostringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
| 1036 |
+
```
|
| 1037 |
+
|
| 1038 |
+
Let `which` be `ios_base::out` for the overload with no parameter
|
| 1039 |
+
`which`, and `a` be `Allocator()` for the overload with no parameter
|
| 1040 |
+
`a`.
|
| 1041 |
+
|
| 1042 |
+
*Constraints:*
|
| 1043 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 1044 |
+
`true`.
|
| 1045 |
+
|
| 1046 |
+
*Effects:* Initializes the base class with `addressof(`*`sb`*`)`, and
|
| 1047 |
+
direct-non-list-initializes *sb* with `t, which | ios_base::out, a`.
|
| 1048 |
+
|
| 1049 |
``` cpp
|
| 1050 |
basic_ostringstream(basic_ostringstream&& rhs);
|
| 1051 |
```
|
| 1052 |
|
| 1053 |
*Effects:* Move constructs from the rvalue `rhs`. This is accomplished
|
| 1054 |
by move constructing the base class, and the contained
|
| 1055 |
`basic_stringbuf`. Then calls
|
| 1056 |
+
`basic_ostream<charT, traits>::set_rdbuf(addressof(`*`sb`*`))` to
|
| 1057 |
+
install the contained `basic_stringbuf`.
|
| 1058 |
|
| 1059 |
#### Swap <a id="ostringstream.swap">[[ostringstream.swap]]</a>
|
| 1060 |
|
| 1061 |
``` cpp
|
| 1062 |
void swap(basic_ostringstream& rhs);
|
|
|
|
| 1073 |
template<class charT, class traits, class Allocator>
|
| 1074 |
void swap(basic_ostringstream<charT, traits, Allocator>& x,
|
| 1075 |
basic_ostringstream<charT, traits, Allocator>& y);
|
| 1076 |
```
|
| 1077 |
|
| 1078 |
+
*Effects:* Equivalent to `x.swap(y)`.
|
| 1079 |
|
| 1080 |
#### Member functions <a id="ostringstream.members">[[ostringstream.members]]</a>
|
| 1081 |
|
| 1082 |
``` cpp
|
| 1083 |
basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
| 1084 |
```
|
| 1085 |
|
| 1086 |
*Returns:*
|
| 1087 |
+
`const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(`*`sb`*`))`.
|
| 1088 |
|
| 1089 |
``` cpp
|
| 1090 |
basic_string<charT, traits, Allocator> str() const &;
|
| 1091 |
```
|
| 1092 |
|
|
|
|
| 1128 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 1129 |
```
|
| 1130 |
|
| 1131 |
*Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
|
| 1132 |
|
| 1133 |
+
``` cpp
|
| 1134 |
+
template<class T>
|
| 1135 |
+
void str(const T& t);
|
| 1136 |
+
```
|
| 1137 |
+
|
| 1138 |
+
*Constraints:*
|
| 1139 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 1140 |
+
`true`.
|
| 1141 |
+
|
| 1142 |
+
*Effects:* Equivalent to: `rdbuf()->str(t);`
|
| 1143 |
+
|
| 1144 |
### Class template `basic_stringstream` <a id="stringstream">[[stringstream]]</a>
|
| 1145 |
|
| 1146 |
#### General <a id="stringstream.general">[[stringstream.general]]</a>
|
| 1147 |
|
| 1148 |
``` cpp
|
| 1149 |
namespace std {
|
| 1150 |
+
template<class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
|
|
|
|
| 1151 |
class basic_stringstream : public basic_iostream<charT, traits> {
|
| 1152 |
public:
|
| 1153 |
using char_type = charT;
|
| 1154 |
+
using int_type = traits::int_type;
|
| 1155 |
+
using pos_type = traits::pos_type;
|
| 1156 |
+
using off_type = traits::off_type;
|
| 1157 |
using traits_type = traits;
|
| 1158 |
using allocator_type = Allocator;
|
| 1159 |
|
| 1160 |
// [stringstream.cons], constructors
|
| 1161 |
basic_stringstream() : basic_stringstream(ios_base::out | ios_base::in) {}
|
|
|
|
| 1177 |
ios_base::openmode which, const Allocator& a);
|
| 1178 |
template<class SAlloc>
|
| 1179 |
explicit basic_stringstream(
|
| 1180 |
const basic_string<charT, traits, SAlloc>& s,
|
| 1181 |
ios_base::openmode which = ios_base::out | ios_base::in);
|
| 1182 |
+
template<class T>
|
| 1183 |
+
explicit basic_stringstream(const T& t,
|
| 1184 |
+
ios_base::openmode which = ios_base::out | ios_base::in);
|
| 1185 |
+
template<class T>
|
| 1186 |
+
basic_stringstream(const T& t, const Allocator& a);
|
| 1187 |
+
template<class T>
|
| 1188 |
+
basic_stringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
| 1189 |
basic_stringstream(const basic_stringstream&) = delete;
|
| 1190 |
basic_stringstream(basic_stringstream&& rhs);
|
| 1191 |
|
| 1192 |
basic_stringstream& operator=(const basic_stringstream&) = delete;
|
| 1193 |
basic_stringstream& operator=(basic_stringstream&& rhs);
|
|
|
|
| 1206 |
|
| 1207 |
void str(const basic_string<charT, traits, Allocator>& s);
|
| 1208 |
template<class SAlloc>
|
| 1209 |
void str(const basic_string<charT, traits, SAlloc>& s);
|
| 1210 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 1211 |
+
template<class T>
|
| 1212 |
+
void str(const T& t);
|
| 1213 |
|
| 1214 |
private:
|
| 1215 |
+
basic_stringbuf<charT, traits, Allocator> sb; // exposition only
|
| 1216 |
};
|
| 1217 |
}
|
| 1218 |
```
|
| 1219 |
|
| 1220 |
The class template `basic_stringstream<charT, traits>` supports reading
|
|
|
|
| 1222 |
`basic_string<charT, traits, Allocator>`. It uses a
|
| 1223 |
`basic_stringbuf<charT, traits, Allocator>` object to control the
|
| 1224 |
associated sequence. For the sake of exposition, the maintained data is
|
| 1225 |
presented here as
|
| 1226 |
|
| 1227 |
+
- *`sb`*, the `stringbuf` object.
|
| 1228 |
|
| 1229 |
#### Constructors <a id="stringstream.cons">[[stringstream.cons]]</a>
|
| 1230 |
|
| 1231 |
``` cpp
|
| 1232 |
explicit basic_stringstream(ios_base::openmode which);
|
| 1233 |
```
|
| 1234 |
|
| 1235 |
*Effects:* Initializes the base class with
|
| 1236 |
+
`basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
|
| 1237 |
+
and *sb* with `basic_stringbuf<charT, traits, Allocator>(which)`.
|
| 1238 |
|
| 1239 |
``` cpp
|
| 1240 |
explicit basic_stringstream(
|
| 1241 |
const basic_string<charT, traits, Allocator>& s,
|
| 1242 |
ios_base::openmode which = ios_base::out | ios_base::in);
|
| 1243 |
```
|
| 1244 |
|
| 1245 |
*Effects:* Initializes the base class with
|
| 1246 |
+
`basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
|
| 1247 |
+
and *sb* with `basic_stringbuf<charT, traits, Allocator>(s, which)`.
|
| 1248 |
|
| 1249 |
``` cpp
|
| 1250 |
basic_stringstream(ios_base::openmode which, const Allocator& a);
|
| 1251 |
```
|
| 1252 |
|
| 1253 |
*Effects:* Initializes the base class with
|
| 1254 |
+
`basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
|
| 1255 |
+
and *sb* with `basic_stringbuf<charT, traits, Allocator>(which, a)`
|
| 1256 |
[[stringbuf.cons]].
|
| 1257 |
|
| 1258 |
``` cpp
|
| 1259 |
explicit basic_stringstream(
|
| 1260 |
basic_string<charT, traits, Allocator>&& s,
|
| 1261 |
ios_base::openmode which = ios_base::out | ios_base::in);
|
| 1262 |
```
|
| 1263 |
|
| 1264 |
*Effects:* Initializes the base class with
|
| 1265 |
+
`basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
|
| 1266 |
+
and *sb* with
|
| 1267 |
`basic_stringbuf<charT, traits, Allocator>(std::move(s), which)`
|
| 1268 |
[[stringbuf.cons]].
|
| 1269 |
|
| 1270 |
``` cpp
|
| 1271 |
template<class SAlloc>
|
|
|
|
| 1273 |
const basic_string<charT, traits, SAlloc>& s,
|
| 1274 |
ios_base::openmode which, const Allocator& a);
|
| 1275 |
```
|
| 1276 |
|
| 1277 |
*Effects:* Initializes the base class with
|
| 1278 |
+
`basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
|
| 1279 |
+
and *sb* with `basic_stringbuf<charT, traits, Allocator>(s, which, a)`
|
| 1280 |
[[stringbuf.cons]].
|
| 1281 |
|
| 1282 |
``` cpp
|
| 1283 |
template<class SAlloc>
|
| 1284 |
explicit basic_stringstream(
|
|
|
|
| 1287 |
```
|
| 1288 |
|
| 1289 |
*Constraints:* `is_same_v<SAlloc, Allocator>` is `false`.
|
| 1290 |
|
| 1291 |
*Effects:* Initializes the base class with
|
| 1292 |
+
`basic_iostream<charT, traits>(addressof(`*`sb`*`))` [[iostream.cons]]
|
| 1293 |
+
and *sb* with `basic_stringbuf<charT, traits, Allocator>(s, which)`
|
| 1294 |
[[stringbuf.cons]].
|
| 1295 |
|
| 1296 |
+
``` cpp
|
| 1297 |
+
template<class T>
|
| 1298 |
+
explicit basic_stringstream(const T& t, ios_base::openmode which = ios_base::out | ios_base::in);
|
| 1299 |
+
template<class T>
|
| 1300 |
+
basic_stringstream(const T& t, const Allocator& a);
|
| 1301 |
+
template<class T>
|
| 1302 |
+
basic_stringstream(const T& t, ios_base::openmode which, const Allocator& a);
|
| 1303 |
+
```
|
| 1304 |
+
|
| 1305 |
+
Let `which` be `ios_base::out | ios_base::in` for the overload with no
|
| 1306 |
+
parameter `which`, and `a` be `Allocator()` for the overload with no
|
| 1307 |
+
parameter `a`.
|
| 1308 |
+
|
| 1309 |
+
*Constraints:*
|
| 1310 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 1311 |
+
`true`.
|
| 1312 |
+
|
| 1313 |
+
*Effects:* Initializes the base class with `addressof(`*`sb`*`)`, and
|
| 1314 |
+
direct-non-list-initializes *sb* with `t, which, a`.
|
| 1315 |
+
|
| 1316 |
``` cpp
|
| 1317 |
basic_stringstream(basic_stringstream&& rhs);
|
| 1318 |
```
|
| 1319 |
|
| 1320 |
*Effects:* Move constructs from the rvalue `rhs`. This is accomplished
|
| 1321 |
by move constructing the base class, and the contained
|
| 1322 |
`basic_stringbuf`. Then calls
|
| 1323 |
+
`basic_istream<charT, traits>::set_rdbuf(addressof(`*`sb`*`))` to
|
| 1324 |
+
install the contained `basic_stringbuf`.
|
| 1325 |
|
| 1326 |
#### Swap <a id="stringstream.swap">[[stringstream.swap]]</a>
|
| 1327 |
|
| 1328 |
``` cpp
|
| 1329 |
void swap(basic_stringstream& rhs);
|
|
|
|
| 1340 |
template<class charT, class traits, class Allocator>
|
| 1341 |
void swap(basic_stringstream<charT, traits, Allocator>& x,
|
| 1342 |
basic_stringstream<charT, traits, Allocator>& y);
|
| 1343 |
```
|
| 1344 |
|
| 1345 |
+
*Effects:* Equivalent to `x.swap(y)`.
|
| 1346 |
|
| 1347 |
#### Member functions <a id="stringstream.members">[[stringstream.members]]</a>
|
| 1348 |
|
| 1349 |
``` cpp
|
| 1350 |
basic_stringbuf<charT, traits, Allocator>* rdbuf() const;
|
| 1351 |
```
|
| 1352 |
|
| 1353 |
*Returns:*
|
| 1354 |
+
`const_cast<basic_stringbuf<charT, traits, Allocator>*>(addressof(`*`sb`*`))`.
|
| 1355 |
|
| 1356 |
``` cpp
|
| 1357 |
basic_string<charT, traits, Allocator> str() const &;
|
| 1358 |
```
|
| 1359 |
|
|
|
|
| 1395 |
void str(basic_string<charT, traits, Allocator>&& s);
|
| 1396 |
```
|
| 1397 |
|
| 1398 |
*Effects:* Equivalent to: `rdbuf()->str(std::move(s));`
|
| 1399 |
|
| 1400 |
+
``` cpp
|
| 1401 |
+
template<class T>
|
| 1402 |
+
void str(const T& t);
|
| 1403 |
+
```
|
| 1404 |
+
|
| 1405 |
+
*Constraints:*
|
| 1406 |
+
`is_convertible_v<const T&, basic_string_view<charT, traits>>` is
|
| 1407 |
+
`true`.
|
| 1408 |
+
|
| 1409 |
+
*Effects:* Equivalent to: `rdbuf()->str(t);`
|
| 1410 |
+
|