From Jason Turner

[depr.str.strstreams]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp6a6fjjnm/{from.md → to.md} +20 -8
tmp/tmp6a6fjjnm/{from.md → to.md} RENAMED
@@ -15,10 +15,12 @@ namespace std {
15
  }
16
  ```
17
 
18
  ### Class `strstreambuf` <a id="depr.strstreambuf">[[depr.strstreambuf]]</a>
19
 
 
 
20
  ``` cpp
21
  namespace std {
22
  class strstreambuf : public basic_streambuf<char> {
23
  public:
24
  strstreambuf() : strstreambuf(0) {}
@@ -74,11 +76,11 @@ attributes.
74
  For the sake of exposition, these are represented as elements of a
75
  bitmask type (indicated here as `T1`) called `strstate`. The elements
76
  are:
77
 
78
  - `allocated`, set when a dynamic array object has been allocated, and
79
- hence should be freed by the destructor for the `strstreambuf` object;
80
  - `constant`, set when the array object has `const` elements, so the
81
  output sequence cannot be written;
82
  - `dynamic`, set when the array object is allocated (or reallocated) as
83
  necessary to hold a character sequence that can change in length;
84
  - `frozen`, set when the program has requested that the array object not
@@ -196,13 +198,13 @@ except that the constructor also sets `constant` in `strmode`.
196
  virtual ~strstreambuf();
197
  ```
198
 
199
  *Effects:* Destroys an object of class `strstreambuf`. The function
200
  frees the dynamically allocated array object only if
201
- `(strmode & allocated) != 0` and
202
- `(strmode & frozen) == 0`. ([[depr.strstreambuf.virtuals]] describes
203
- how a dynamically allocated array object is freed.)
204
 
205
  #### Member functions <a id="depr.strstreambuf.members">[[depr.strstreambuf.members]]</a>
206
 
207
  ``` cpp
208
  void freeze(bool freezefl = true);
@@ -255,11 +257,11 @@ available as a result of any call.
255
 
256
  To make a write position available, the function reallocates (or
257
  initially allocates) an array object with a sufficient number of
258
  elements `n` to hold the current array object (if any), plus at least
259
  one additional write position. How many additional write positions are
260
- made available is otherwise unspecified. [^2] If `palloc` is not a null
261
  pointer, the function calls `(*palloc)(n)` to allocate the new dynamic
262
  array object. Otherwise, it evaluates the expression `new charT[n]`. In
263
  either case, if the allocation fails, the function returns `EOF`.
264
  Otherwise, it sets `allocated` in `strmode`.
265
 
@@ -269,10 +271,14 @@ address is `p`: If `pfree` is not a null pointer, the function calls
269
 
270
  If `(strmode & dynamic) == 0`, or if `(strmode & frozen) != 0`, the
271
  function cannot extend the array (reallocate it with greater length) to
272
  make a write position available.
273
 
 
 
 
 
274
  ``` cpp
275
  int_type pbackfail(int_type c = EOF) override;
276
  ```
277
 
278
  Puts back the character designated by `c` to the input sequence, if
@@ -280,12 +286,12 @@ possible, in one of three ways:
280
 
281
  - If `c != EOF`, if the input sequence has a putback position available,
282
  and if `(char)c == gnext[-1]`, assigns `gnext - 1` to `gnext`. Returns
283
  `c`.
284
  - If `c != EOF`, if the input sequence has a putback position available,
285
- and if `strmode & constant` is zero, assigns `c` to `*`\dcr`gnext`.
286
- Returns `c`.
287
  - If `c == EOF` and if the input sequence has a putback position
288
  available, assigns `gnext - 1` to `gnext`. Returns a value other than
289
  `EOF`.
290
 
291
  Returns `EOF` to indicate failure.
@@ -392,10 +398,12 @@ streambuf<char>* setbuf(char* s, streamsize n) override;
392
  *Effects:* Behavior is *implementation-defined*, except that
393
  `setbuf(0, 0)` has no effect.
394
 
395
  ### Class `istrstream` <a id="depr.istrstream">[[depr.istrstream]]</a>
396
 
 
 
397
  ``` cpp
398
  namespace std {
399
  class istrstream : public basic_istream<char> {
400
  public:
401
  explicit istrstream(const char* s);
@@ -452,10 +460,12 @@ char* str();
452
 
453
  *Returns:* `rdbuf()->str()`.
454
 
455
  ### Class `ostrstream` <a id="depr.ostrstream">[[depr.ostrstream]]</a>
456
 
 
 
457
  ``` cpp
458
  namespace std {
459
  class ostrstream : public basic_ostream<char> {
460
  public:
461
  ostrstream();
@@ -498,11 +508,11 @@ one of two constructors:
498
  - If `(mode & app) == 0`, then `s` shall designate the first element of
499
  an array of `n` elements. The constructor is `strstreambuf(s, n, s)`.
500
  - If `(mode & app) != 0`, then `s` shall designate the first element of
501
  an array of `n` elements that contains an NTBS whose first element is
502
  designated by `s`. The constructor is
503
- `strstreambuf(s, n, s + std::strlen(s))`.[^3]
504
 
505
  #### Member functions <a id="depr.ostrstream.members">[[depr.ostrstream.members]]</a>
506
 
507
  ``` cpp
508
  strstreambuf* rdbuf() const;
@@ -528,10 +538,12 @@ int pcount() const;
528
 
529
  *Returns:* `rdbuf()->pcount()`.
530
 
531
  ### Class `strstream` <a id="depr.strstream">[[depr.strstream]]</a>
532
 
 
 
533
  ``` cpp
534
  namespace std {
535
  class strstream
536
  : public basic_iostream<char> {
537
  public:
 
15
  }
16
  ```
17
 
18
  ### Class `strstreambuf` <a id="depr.strstreambuf">[[depr.strstreambuf]]</a>
19
 
20
+ #### General <a id="depr.strstreambuf.general">[[depr.strstreambuf.general]]</a>
21
+
22
  ``` cpp
23
  namespace std {
24
  class strstreambuf : public basic_streambuf<char> {
25
  public:
26
  strstreambuf() : strstreambuf(0) {}
 
76
  For the sake of exposition, these are represented as elements of a
77
  bitmask type (indicated here as `T1`) called `strstate`. The elements
78
  are:
79
 
80
  - `allocated`, set when a dynamic array object has been allocated, and
81
+ hence will be freed by the destructor for the `strstreambuf` object;
82
  - `constant`, set when the array object has `const` elements, so the
83
  output sequence cannot be written;
84
  - `dynamic`, set when the array object is allocated (or reallocated) as
85
  necessary to hold a character sequence that can change in length;
86
  - `frozen`, set when the program has requested that the array object not
 
198
  virtual ~strstreambuf();
199
  ```
200
 
201
  *Effects:* Destroys an object of class `strstreambuf`. The function
202
  frees the dynamically allocated array object only if
203
+ `(strmode & allocated) != 0` and `(strmode & frozen) == 0`.
204
+ ([[depr.strstreambuf.virtuals]] describes how a dynamically allocated
205
+ array object is freed.)
206
 
207
  #### Member functions <a id="depr.strstreambuf.members">[[depr.strstreambuf.members]]</a>
208
 
209
  ``` cpp
210
  void freeze(bool freezefl = true);
 
257
 
258
  To make a write position available, the function reallocates (or
259
  initially allocates) an array object with a sufficient number of
260
  elements `n` to hold the current array object (if any), plus at least
261
  one additional write position. How many additional write positions are
262
+ made available is otherwise unspecified. If `palloc` is not a null
263
  pointer, the function calls `(*palloc)(n)` to allocate the new dynamic
264
  array object. Otherwise, it evaluates the expression `new charT[n]`. In
265
  either case, if the allocation fails, the function returns `EOF`.
266
  Otherwise, it sets `allocated` in `strmode`.
267
 
 
271
 
272
  If `(strmode & dynamic) == 0`, or if `(strmode & frozen) != 0`, the
273
  function cannot extend the array (reallocate it with greater length) to
274
  make a write position available.
275
 
276
+ *Recommended practice:* An implementation should consider `alsize` in
277
+ making the decision how many additional write positions to make
278
+ available.
279
+
280
  ``` cpp
281
  int_type pbackfail(int_type c = EOF) override;
282
  ```
283
 
284
  Puts back the character designated by `c` to the input sequence, if
 
286
 
287
  - If `c != EOF`, if the input sequence has a putback position available,
288
  and if `(char)c == gnext[-1]`, assigns `gnext - 1` to `gnext`. Returns
289
  `c`.
290
  - If `c != EOF`, if the input sequence has a putback position available,
291
+ and if `strmode & constant` is zero, assigns `c` to `*gnext`. Returns
292
+ `c`.
293
  - If `c == EOF` and if the input sequence has a putback position
294
  available, assigns `gnext - 1` to `gnext`. Returns a value other than
295
  `EOF`.
296
 
297
  Returns `EOF` to indicate failure.
 
398
  *Effects:* Behavior is *implementation-defined*, except that
399
  `setbuf(0, 0)` has no effect.
400
 
401
  ### Class `istrstream` <a id="depr.istrstream">[[depr.istrstream]]</a>
402
 
403
+ #### General <a id="depr.istrstream.general">[[depr.istrstream.general]]</a>
404
+
405
  ``` cpp
406
  namespace std {
407
  class istrstream : public basic_istream<char> {
408
  public:
409
  explicit istrstream(const char* s);
 
460
 
461
  *Returns:* `rdbuf()->str()`.
462
 
463
  ### Class `ostrstream` <a id="depr.ostrstream">[[depr.ostrstream]]</a>
464
 
465
+ #### General <a id="depr.ostrstream.general">[[depr.ostrstream.general]]</a>
466
+
467
  ``` cpp
468
  namespace std {
469
  class ostrstream : public basic_ostream<char> {
470
  public:
471
  ostrstream();
 
508
  - If `(mode & app) == 0`, then `s` shall designate the first element of
509
  an array of `n` elements. The constructor is `strstreambuf(s, n, s)`.
510
  - If `(mode & app) != 0`, then `s` shall designate the first element of
511
  an array of `n` elements that contains an NTBS whose first element is
512
  designated by `s`. The constructor is
513
+ `strstreambuf(s, n, s + std::strlen(s))`.[^2]
514
 
515
  #### Member functions <a id="depr.ostrstream.members">[[depr.ostrstream.members]]</a>
516
 
517
  ``` cpp
518
  strstreambuf* rdbuf() const;
 
538
 
539
  *Returns:* `rdbuf()->pcount()`.
540
 
541
  ### Class `strstream` <a id="depr.strstream">[[depr.strstream]]</a>
542
 
543
+ #### General <a id="depr.strstream.general">[[depr.strstream.general]]</a>
544
+
545
  ``` cpp
546
  namespace std {
547
  class strstream
548
  : public basic_iostream<char> {
549
  public: