From Jason Turner

[ios.base]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmpkha68jda/{from.md → to.md} +85 -87
tmp/tmpkha68jda/{from.md → to.md} RENAMED
@@ -4,11 +4,11 @@
4
  namespace std {
5
  class ios_base {
6
  public:
7
  class failure; // see below
8
 
9
- // [ios::fmtflags], fmtflags
10
  using fmtflags = T1;
11
  static constexpr fmtflags boolalpha = unspecified;
12
  static constexpr fmtflags dec = unspecified;
13
  static constexpr fmtflags fixed = unspecified;
14
  static constexpr fmtflags hex = unspecified;
@@ -25,27 +25,27 @@ namespace std {
25
  static constexpr fmtflags uppercase = unspecified;
26
  static constexpr fmtflags adjustfield = see below;
27
  static constexpr fmtflags basefield = see below;
28
  static constexpr fmtflags floatfield = see below;
29
 
30
- // [ios::iostate], iostate
31
  using iostate = T2;
32
  static constexpr iostate badbit = unspecified;
33
  static constexpr iostate eofbit = unspecified;
34
  static constexpr iostate failbit = unspecified;
35
  static constexpr iostate goodbit = see below;
36
 
37
- // [ios::openmode], openmode
38
  using openmode = T3;
39
  static constexpr openmode app = unspecified;
40
  static constexpr openmode ate = unspecified;
41
  static constexpr openmode binary = unspecified;
42
  static constexpr openmode in = unspecified;
43
  static constexpr openmode out = unspecified;
44
  static constexpr openmode trunc = unspecified;
45
 
46
- // [ios::seekdir], seekdir
47
  using seekdir = T4;
48
  static constexpr seekdir beg = unspecified;
49
  static constexpr seekdir cur = unspecified;
50
  static constexpr seekdir end = unspecified;
51
 
@@ -67,20 +67,20 @@ namespace std {
67
  locale imbue(const locale& loc);
68
  locale getloc() const;
69
 
70
  // [ios.base.storage], storage
71
  static int xalloc();
72
- long& iword(int index);
73
- void*& pword(int index);
74
 
75
- // destructor:
76
  virtual ~ios_base();
77
 
78
- // [ios.base.callback], callbacks;
79
  enum event { erase_event, imbue_event, copyfmt_event };
80
- using event_callback = void (*)(event, ios_base&, int index);
81
- void register_callback(event_callback fn, int index);
82
 
83
  ios_base(const ios_base&) = delete;
84
  ios_base& operator=(const ios_base&) = delete;
85
 
86
  static bool sync_with_stdio(bool sync = true);
@@ -128,11 +128,11 @@ For the sake of exposition, the maintained data is presented here as:
128
 
129
  — *end note*]
130
 
131
  #### Types <a id="ios.types">[[ios.types]]</a>
132
 
133
- ##### Class `ios_base::failure` <a id="ios::failure">[[ios::failure]]</a>
134
 
135
  ``` cpp
136
  namespace std {
137
  class ios_base::failure : public system_error {
138
  public:
@@ -144,13 +144,13 @@ namespace std {
144
 
145
  An implementation is permitted to define `ios_base::failure` as a
146
  synonym for a class with equivalent functionality to class
147
  `ios_base::failure` shown in this subclause.
148
 
149
- [*Note 1*: When `ios_base::failure` is a synonym for another type it
150
- shall provide a nested type `failure`, to emulate the injected class
151
- name. — *end note*]
152
 
153
  The class `failure` defines the base class for the types of all objects
154
  thrown as exceptions, by functions in the iostreams library, to report
155
  errors detected during stream buffer operations.
156
 
@@ -167,31 +167,28 @@ iostream_category())`. — *end note*]
167
 
168
  ``` cpp
169
  explicit failure(const string& msg, const error_code& ec = io_errc::stream);
170
  ```
171
 
172
- *Effects:* Constructs an object of class `failure` by constructing the
173
- base class with `msg` and `ec`.
174
 
175
  ``` cpp
176
  explicit failure(const char* msg, const error_code& ec = io_errc::stream);
177
  ```
178
 
179
- *Effects:* Constructs an object of class `failure` by constructing the
180
- base class with `msg` and `ec`.
181
 
182
- ##### Type `ios_base::fmtflags` <a id="ios::fmtflags">[[ios::fmtflags]]</a>
183
 
184
  ``` cpp
185
  using fmtflags = T1;
186
  ```
187
 
188
- The type `fmtflags` is a bitmask type ([[bitmask.types]]). Setting its
189
- elements has the effects indicated in
190
- Table  [[tab:iostreams.fmtflags.effects]].
191
 
192
- **Table: `fmtflags` effects** <a id="tab:iostreams.fmtflags.effects">[tab:iostreams.fmtflags.effects]</a>
193
 
194
  | Element | Effect(s) if set |
195
  | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
196
  | `boolalpha` | insert and extract `bool` type in alphabetic format |
197
  | `dec` | converts integer input or generates integer output in decimal base |
@@ -209,31 +206,31 @@ Table  [[tab:iostreams.fmtflags.effects]].
209
  | `unitbuf` | flushes output after each output operation |
210
  | `uppercase` | replaces certain lowercase letters with their uppercase equivalents in generated output |
211
 
212
 
213
  Type `fmtflags` also defines the constants indicated in
214
- Table  [[tab:iostreams.fmtflags.constants]].
215
 
216
- **Table: `fmtflags` constants** <a id="tab:iostreams.fmtflags.constants">[tab:iostreams.fmtflags.constants]</a>
217
 
218
  | Constant | Allowable values |
219
  | ------------- | ------------------------- |
220
  | `adjustfield` | `left | right | internal` |
221
  | `basefield` | `dec | oct | hex` |
222
  | `floatfield` | `scientific | fixed` |
223
 
224
 
225
- ##### Type `ios_base::iostate` <a id="ios::iostate">[[ios::iostate]]</a>
226
 
227
  ``` cpp
228
  using iostate = T2;
229
  ```
230
 
231
- The type `iostate` is a bitmask type ([[bitmask.types]]) that contains
232
- the elements indicated in Table  [[tab:iostreams.iostate.effects]].
233
 
234
- **Table: `iostate` effects** <a id="tab:iostreams.iostate.effects">[tab:iostreams.iostate.effects]</a>
235
 
236
  | Element | Effect(s) if set |
237
  | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
238
  | `badbit` | indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file); |
239
  | `eofbit` | indicates that an input operation reached the end of an input sequence; |
@@ -242,20 +239,20 @@ the elements indicated in Table  [[tab:iostreams.iostate.effects]].
242
 
243
  Type `iostate` also defines the constant:
244
 
245
  - `goodbit`, the value zero.
246
 
247
- ##### Type `ios_base::openmode` <a id="ios::openmode">[[ios::openmode]]</a>
248
 
249
  ``` cpp
250
  using openmode = T3;
251
  ```
252
 
253
- The type `openmode` is a bitmask type ([[bitmask.types]]). It contains
254
- the elements indicated in Table  [[tab:iostreams.openmode.effects]].
255
 
256
- **Table: `openmode` effects** <a id="tab:iostreams.openmode.effects">[tab:iostreams.openmode.effects]</a>
257
 
258
  | Element | Effect(s) if set |
259
  | -------- | ----------------------------------------------------------------- |
260
  | `app` | seek to end before each write |
261
  | `ate` | open and seek to end immediately after opening |
@@ -263,73 +260,71 @@ the elements indicated in Table  [[tab:iostreams.openmode.effects]].
263
  | `in` | open for input |
264
  | `out` | open for output |
265
  | `trunc` | truncate an existing stream when opening |
266
 
267
 
268
- ##### Type `ios_base::seekdir` <a id="ios::seekdir">[[ios::seekdir]]</a>
269
 
270
  ``` cpp
271
  using seekdir = T4;
272
  ```
273
 
274
- The type `seekdir` is an enumerated type ([[enumerated.types]]) that
275
- contains the elements indicated in
276
- Table  [[tab:iostreams.seekdir.effects]].
277
 
278
- **Table: `seekdir` effects** <a id="tab:iostreams.seekdir.effects">[tab:iostreams.seekdir.effects]</a>
279
 
280
  | Element | Meaning |
281
  | ------- | --------------------------------------------------------------------------------------- |
282
  | `beg` | request a seek (for subsequent input or output) relative to the beginning of the stream |
283
  | `cur` | request a seek relative to the current position within the sequence |
284
  | `end` | request a seek relative to the current end of the sequence |
285
 
286
 
287
- ##### Class `ios_base::Init` <a id="ios::Init">[[ios::Init]]</a>
288
 
289
  ``` cpp
290
  namespace std {
291
  class ios_base::Init {
292
  public:
293
  Init();
 
294
  ~Init();
 
295
  private:
296
  static int init_cnt; // exposition only
297
  };
298
  }
299
  ```
300
 
301
  The class `Init` describes an object whose construction ensures the
302
- construction of the eight objects declared in `<iostream>` (
303
- [[iostream.objects]]) that associate file stream buffers with the
304
- standard C streams provided for by the functions declared in
305
- `<cstdio>` ([[cstdio.syn]]).
306
 
307
  For the sake of exposition, the maintained data is presented here as:
308
 
309
  - `static int init_cnt`, counts the number of constructor and destructor
310
  calls for class `Init`, initialized to zero.
311
 
312
  ``` cpp
313
  Init();
314
  ```
315
 
316
- *Effects:* Constructs an object of class `Init`. Constructs and
317
- initializes the objects `cin`, `cout`, `cerr`, `clog`, `wcin`, `wcout`,
318
- `wcerr`, and `wclog` if they have not already been constructed and
319
- initialized.
320
 
321
  ``` cpp
322
  ~Init();
323
  ```
324
 
325
- *Effects:* Destroys an object of class `Init`. If there are no other
326
- instances of the class still in existence, calls `cout.flush()`,
327
- `cerr.flush()`, `clog.flush()`, `wcout.flush()`, `wcerr.flush()`,
328
- `wclog.flush()`.
329
 
330
- #### `ios_base` state functions <a id="fmtflags.state">[[fmtflags.state]]</a>
331
 
332
  ``` cpp
333
  fmtflags flags() const;
334
  ```
335
 
@@ -337,11 +332,11 @@ fmtflags flags() const;
337
 
338
  ``` cpp
339
  fmtflags flags(fmtflags fmtfl);
340
  ```
341
 
342
- *Postconditions:* `fmtfl == flags()`.
343
 
344
  *Returns:* The previous value of `flags()`.
345
 
346
  ``` cpp
347
  fmtflags setf(fmtflags fmtfl);
@@ -373,11 +368,11 @@ streamsize precision() const;
373
 
374
  ``` cpp
375
  streamsize precision(streamsize prec);
376
  ```
377
 
378
- *Postconditions:* `prec == precision()`.
379
 
380
  *Returns:* The previous value of `precision()`.
381
 
382
  ``` cpp
383
  streamsize width() const;
@@ -388,47 +383,46 @@ certain output conversions.
388
 
389
  ``` cpp
390
  streamsize width(streamsize wide);
391
  ```
392
 
393
- *Postconditions:* `wide == width()`.
394
 
395
  *Returns:* The previous value of `width()`.
396
 
397
- #### `ios_base` functions <a id="ios.base.locales">[[ios.base.locales]]</a>
398
 
399
  ``` cpp
400
  locale imbue(const locale& loc);
401
  ```
402
 
403
- *Effects:* Calls each registered callback pair
404
- `(fn, index)` ([[ios.base.callback]]) as
405
- `(*fn)(imbue_event, *this, index)` at such a time that a call to
406
- `ios_base::getloc()` from within `fn` returns the new locale value
407
- `loc`.
 
408
 
409
  *Returns:* The previous value of `getloc()`.
410
 
411
- *Postconditions:* `loc == getloc()`.
412
-
413
  ``` cpp
414
  locale getloc() const;
415
  ```
416
 
417
- *Returns:* If no locale has been imbued, a copy of the global C++locale,
418
- `locale()`, in effect at the time of construction. Otherwise, returns
419
- the imbued locale, to be used to perform locale-dependent input and
420
- output operations.
421
 
422
- #### `ios_base` static members <a id="ios.members.static">[[ios.members.static]]</a>
423
 
424
  ``` cpp
425
- bool sync_with_stdio(bool sync = true);
426
  ```
427
 
428
  *Returns:* `true` if the previous state of the standard iostream
429
- objects ([[iostream.objects]]) was synchronized and otherwise returns
430
  `false`. The first time it is called, the function returns `true`.
431
 
432
  *Effects:* If any input or output operation has occurred using the
433
  standard streams prior to the call, the effect is
434
  *implementation-defined*. Otherwise, called with a `false` argument, it
@@ -474,25 +468,27 @@ is the same as the effect of
474
  str.rdbuf()->sputbackc(c);
475
  ```
476
 
477
  for any sequence of characters.[^6]
478
 
479
- #### `ios_base` storage functions <a id="ios.base.storage">[[ios.base.storage]]</a>
480
 
481
  ``` cpp
482
  static int xalloc();
483
  ```
484
 
485
  *Returns:* `index` `++`.
486
 
487
- *Remarks:* Concurrent access to this function by multiple threads shall
488
- not result in a data race ([[intro.multithread]]).
489
 
490
  ``` cpp
491
  long& iword(int idx);
492
  ```
493
 
 
 
494
  *Effects:* If `iarray` is a null pointer, allocates an array of `long`
495
  of unspecified size and stores a pointer to its first element in
496
  `iarray`. The function then extends the array pointed at by `iarray` as
497
  necessary to include the element `iarray[idx]`. Each newly allocated
498
  element of the array is initialized to zero. The reference returned is
@@ -509,10 +505,12 @@ initialized to 0.
509
 
510
  ``` cpp
511
  void*& pword(int idx);
512
  ```
513
 
 
 
514
  *Effects:* If `parray` is a null pointer, allocates an array of pointers
515
  to `void` of unspecified size and stores a pointer to its first element
516
  in `parray`. The function then extends the array pointed at by `parray`
517
  as necessary to include the element `parray[idx]`. Each newly allocated
518
  element of the array is initialized to a null pointer. The reference
@@ -528,29 +526,29 @@ object (which may throw `failure`).
528
  initialized to 0.
529
 
530
  *Remarks:* After a subsequent call to `pword(int)` for the same object,
531
  the earlier return value may no longer be valid.
532
 
533
- #### `ios_base` callbacks <a id="ios.base.callback">[[ios.base.callback]]</a>
534
 
535
  ``` cpp
536
- void register_callback(event_callback fn, int index);
537
  ```
538
 
539
- *Effects:* Registers the pair `(fn, index)` such that during calls to
540
- `imbue()` ([[ios.base.locales]]), `copyfmt()`, or
541
- `~ios_base()` ([[ios.base.cons]]), the function `fn` is called with
542
- argument `index`. Functions registered are called when an event occurs,
543
- in opposite order of registration. Functions registered while a callback
544
- function is active are not called until the next event.
545
 
546
- *Requires:* The function `fn` shall not throw exceptions.
 
 
 
 
 
547
 
548
  *Remarks:* Identical pairs are not merged. A function registered twice
549
  will be called twice.
550
 
551
- #### `ios_base` constructors/destructor <a id="ios.base.cons">[[ios.base.cons]]</a>
552
 
553
  ``` cpp
554
  ios_base();
555
  ```
556
 
@@ -561,10 +559,10 @@ destroyed, whichever comes first; otherwise the behavior is undefined.
561
 
562
  ``` cpp
563
  ~ios_base();
564
  ```
565
 
566
- *Effects:* Destroys an object of class `ios_base`. Calls each registered
567
- callback pair `(fn, index)` ([[ios.base.callback]]) as
568
- `(*fn)(erase_event, *this, index)` at such time that any `ios_base`
569
- member function called from within `fn` has well defined results.
570
 
 
4
  namespace std {
5
  class ios_base {
6
  public:
7
  class failure; // see below
8
 
9
+ // [ios.fmtflags], fmtflags
10
  using fmtflags = T1;
11
  static constexpr fmtflags boolalpha = unspecified;
12
  static constexpr fmtflags dec = unspecified;
13
  static constexpr fmtflags fixed = unspecified;
14
  static constexpr fmtflags hex = unspecified;
 
25
  static constexpr fmtflags uppercase = unspecified;
26
  static constexpr fmtflags adjustfield = see below;
27
  static constexpr fmtflags basefield = see below;
28
  static constexpr fmtflags floatfield = see below;
29
 
30
+ // [ios.iostate], iostate
31
  using iostate = T2;
32
  static constexpr iostate badbit = unspecified;
33
  static constexpr iostate eofbit = unspecified;
34
  static constexpr iostate failbit = unspecified;
35
  static constexpr iostate goodbit = see below;
36
 
37
+ // [ios.openmode], openmode
38
  using openmode = T3;
39
  static constexpr openmode app = unspecified;
40
  static constexpr openmode ate = unspecified;
41
  static constexpr openmode binary = unspecified;
42
  static constexpr openmode in = unspecified;
43
  static constexpr openmode out = unspecified;
44
  static constexpr openmode trunc = unspecified;
45
 
46
+ // [ios.seekdir], seekdir
47
  using seekdir = T4;
48
  static constexpr seekdir beg = unspecified;
49
  static constexpr seekdir cur = unspecified;
50
  static constexpr seekdir end = unspecified;
51
 
 
67
  locale imbue(const locale& loc);
68
  locale getloc() const;
69
 
70
  // [ios.base.storage], storage
71
  static int xalloc();
72
+ long& iword(int idx);
73
+ void*& pword(int idx);
74
 
75
+ // destructor
76
  virtual ~ios_base();
77
 
78
+ // [ios.base.callback], callbacks
79
  enum event { erase_event, imbue_event, copyfmt_event };
80
+ using event_callback = void (*)(event, ios_base&, int idx);
81
+ void register_callback(event_callback fn, int idx);
82
 
83
  ios_base(const ios_base&) = delete;
84
  ios_base& operator=(const ios_base&) = delete;
85
 
86
  static bool sync_with_stdio(bool sync = true);
 
128
 
129
  — *end note*]
130
 
131
  #### Types <a id="ios.types">[[ios.types]]</a>
132
 
133
+ ##### Class `ios_base::failure` <a id="ios.failure">[[ios.failure]]</a>
134
 
135
  ``` cpp
136
  namespace std {
137
  class ios_base::failure : public system_error {
138
  public:
 
144
 
145
  An implementation is permitted to define `ios_base::failure` as a
146
  synonym for a class with equivalent functionality to class
147
  `ios_base::failure` shown in this subclause.
148
 
149
+ [*Note 1*: When `ios_base::failure` is a synonym for another type, that
150
+ type is required to provide a nested type `failure` to emulate the
151
+ injected-class-name. — *end note*]
152
 
153
  The class `failure` defines the base class for the types of all objects
154
  thrown as exceptions, by functions in the iostreams library, to report
155
  errors detected during stream buffer operations.
156
 
 
167
 
168
  ``` cpp
169
  explicit failure(const string& msg, const error_code& ec = io_errc::stream);
170
  ```
171
 
172
+ *Effects:* Constructs the base class with `msg` and `ec`.
 
173
 
174
  ``` cpp
175
  explicit failure(const char* msg, const error_code& ec = io_errc::stream);
176
  ```
177
 
178
+ *Effects:* Constructs the base class with `msg` and `ec`.
 
179
 
180
+ ##### Type `ios_base::fmtflags` <a id="ios.fmtflags">[[ios.fmtflags]]</a>
181
 
182
  ``` cpp
183
  using fmtflags = T1;
184
  ```
185
 
186
+ The type `fmtflags` is a bitmask type [[bitmask.types]]. Setting its
187
+ elements has the effects indicated in [[ios.fmtflags]].
 
188
 
189
+ **Table: `fmtflags` effects** <a id="ios.fmtflags">[ios.fmtflags]</a>
190
 
191
  | Element | Effect(s) if set |
192
  | ------------ | --------------------------------------------------------------------------------------------------------------------------------------- |
193
  | `boolalpha` | insert and extract `bool` type in alphabetic format |
194
  | `dec` | converts integer input or generates integer output in decimal base |
 
206
  | `unitbuf` | flushes output after each output operation |
207
  | `uppercase` | replaces certain lowercase letters with their uppercase equivalents in generated output |
208
 
209
 
210
  Type `fmtflags` also defines the constants indicated in
211
+ [[ios.fmtflags.const]].
212
 
213
+ **Table: `fmtflags` constants** <a id="ios.fmtflags.const">[ios.fmtflags.const]</a>
214
 
215
  | Constant | Allowable values |
216
  | ------------- | ------------------------- |
217
  | `adjustfield` | `left | right | internal` |
218
  | `basefield` | `dec | oct | hex` |
219
  | `floatfield` | `scientific | fixed` |
220
 
221
 
222
+ ##### Type `ios_base::iostate` <a id="ios.iostate">[[ios.iostate]]</a>
223
 
224
  ``` cpp
225
  using iostate = T2;
226
  ```
227
 
228
+ The type `iostate` is a bitmask type [[bitmask.types]] that contains the
229
+ elements indicated in [[ios.iostate]].
230
 
231
+ **Table: `iostate` effects** <a id="ios.iostate">[ios.iostate]</a>
232
 
233
  | Element | Effect(s) if set |
234
  | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
235
  | `badbit` | indicates a loss of integrity in an input or output sequence (such as an irrecoverable read error from a file); |
236
  | `eofbit` | indicates that an input operation reached the end of an input sequence; |
 
239
 
240
  Type `iostate` also defines the constant:
241
 
242
  - `goodbit`, the value zero.
243
 
244
+ ##### Type `ios_base::openmode` <a id="ios.openmode">[[ios.openmode]]</a>
245
 
246
  ``` cpp
247
  using openmode = T3;
248
  ```
249
 
250
+ The type `openmode` is a bitmask type [[bitmask.types]]. It contains the
251
+ elements indicated in [[ios.openmode]].
252
 
253
+ **Table: `openmode` effects** <a id="ios.openmode">[ios.openmode]</a>
254
 
255
  | Element | Effect(s) if set |
256
  | -------- | ----------------------------------------------------------------- |
257
  | `app` | seek to end before each write |
258
  | `ate` | open and seek to end immediately after opening |
 
260
  | `in` | open for input |
261
  | `out` | open for output |
262
  | `trunc` | truncate an existing stream when opening |
263
 
264
 
265
+ ##### Type `ios_base::seekdir` <a id="ios.seekdir">[[ios.seekdir]]</a>
266
 
267
  ``` cpp
268
  using seekdir = T4;
269
  ```
270
 
271
+ The type `seekdir` is an enumerated type [[enumerated.types]] that
272
+ contains the elements indicated in [[ios.seekdir]].
 
273
 
274
+ **Table: `seekdir` effects** <a id="ios.seekdir">[ios.seekdir]</a>
275
 
276
  | Element | Meaning |
277
  | ------- | --------------------------------------------------------------------------------------- |
278
  | `beg` | request a seek (for subsequent input or output) relative to the beginning of the stream |
279
  | `cur` | request a seek relative to the current position within the sequence |
280
  | `end` | request a seek relative to the current end of the sequence |
281
 
282
 
283
+ ##### Class `ios_base::Init` <a id="ios.init">[[ios.init]]</a>
284
 
285
  ``` cpp
286
  namespace std {
287
  class ios_base::Init {
288
  public:
289
  Init();
290
+ Init(const Init&) = default;
291
  ~Init();
292
+ Init& operator=(const Init&) = default;
293
  private:
294
  static int init_cnt; // exposition only
295
  };
296
  }
297
  ```
298
 
299
  The class `Init` describes an object whose construction ensures the
300
+ construction of the eight objects declared in `<iostream>`
301
+ [[iostream.objects]] that associate file stream buffers with the
302
+ standard C streams provided for by the functions declared in `<cstdio>`.
 
303
 
304
  For the sake of exposition, the maintained data is presented here as:
305
 
306
  - `static int init_cnt`, counts the number of constructor and destructor
307
  calls for class `Init`, initialized to zero.
308
 
309
  ``` cpp
310
  Init();
311
  ```
312
 
313
+ *Effects:* Constructs and initializes the objects `cin`, `cout`, `cerr`,
314
+ `clog`, `wcin`, `wcout`, `wcerr`, and `wclog` if they have not already
315
+ been constructed and initialized.
 
316
 
317
  ``` cpp
318
  ~Init();
319
  ```
320
 
321
+ *Effects:* If there are no other instances of the class still in
322
+ existence, calls `cout.flush()`, `cerr.flush()`, `clog.flush()`,
323
+ `wcout.flush()`, `wcerr.flush()`, `wclog.flush()`.
 
324
 
325
+ #### State functions <a id="fmtflags.state">[[fmtflags.state]]</a>
326
 
327
  ``` cpp
328
  fmtflags flags() const;
329
  ```
330
 
 
332
 
333
  ``` cpp
334
  fmtflags flags(fmtflags fmtfl);
335
  ```
336
 
337
+ *Ensures:* `fmtfl == flags()`.
338
 
339
  *Returns:* The previous value of `flags()`.
340
 
341
  ``` cpp
342
  fmtflags setf(fmtflags fmtfl);
 
368
 
369
  ``` cpp
370
  streamsize precision(streamsize prec);
371
  ```
372
 
373
+ *Ensures:* `prec == precision()`.
374
 
375
  *Returns:* The previous value of `precision()`.
376
 
377
  ``` cpp
378
  streamsize width() const;
 
383
 
384
  ``` cpp
385
  streamsize width(streamsize wide);
386
  ```
387
 
388
+ *Ensures:* `wide == width()`.
389
 
390
  *Returns:* The previous value of `width()`.
391
 
392
+ #### Functions <a id="ios.base.locales">[[ios.base.locales]]</a>
393
 
394
  ``` cpp
395
  locale imbue(const locale& loc);
396
  ```
397
 
398
+ *Effects:* Calls each registered callback pair `(fn, idx)`
399
+ [[ios.base.callback]] as `(*fn)(imbue_event, *this, idx)` at such a time
400
+ that a call to `ios_base::getloc()` from within `fn` returns the new
401
+ locale value `loc`.
402
+
403
+ *Ensures:* `loc == getloc()`.
404
 
405
  *Returns:* The previous value of `getloc()`.
406
 
 
 
407
  ``` cpp
408
  locale getloc() const;
409
  ```
410
 
411
+ *Returns:* If no locale has been imbued, a copy of the global C++
412
+ locale, `locale()`, in effect at the time of construction. Otherwise,
413
+ returns the imbued locale, to be used to perform locale-dependent input
414
+ and output operations.
415
 
416
+ #### Static members <a id="ios.members.static">[[ios.members.static]]</a>
417
 
418
  ``` cpp
419
+ static bool sync_with_stdio(bool sync = true);
420
  ```
421
 
422
  *Returns:* `true` if the previous state of the standard iostream
423
+ objects [[iostream.objects]] was synchronized and otherwise returns
424
  `false`. The first time it is called, the function returns `true`.
425
 
426
  *Effects:* If any input or output operation has occurred using the
427
  standard streams prior to the call, the effect is
428
  *implementation-defined*. Otherwise, called with a `false` argument, it
 
468
  str.rdbuf()->sputbackc(c);
469
  ```
470
 
471
  for any sequence of characters.[^6]
472
 
473
+ #### Storage functions <a id="ios.base.storage">[[ios.base.storage]]</a>
474
 
475
  ``` cpp
476
  static int xalloc();
477
  ```
478
 
479
  *Returns:* `index` `++`.
480
 
481
+ *Remarks:* Concurrent access to this function by multiple threads does
482
+ not result in a data race [[intro.multithread]].
483
 
484
  ``` cpp
485
  long& iword(int idx);
486
  ```
487
 
488
+ *Preconditions:* `idx` is a value obtained by a call to `xalloc`.
489
+
490
  *Effects:* If `iarray` is a null pointer, allocates an array of `long`
491
  of unspecified size and stores a pointer to its first element in
492
  `iarray`. The function then extends the array pointed at by `iarray` as
493
  necessary to include the element `iarray[idx]`. Each newly allocated
494
  element of the array is initialized to zero. The reference returned is
 
505
 
506
  ``` cpp
507
  void*& pword(int idx);
508
  ```
509
 
510
+ *Preconditions:* `idx` is a value obtained by a call to `xalloc`.
511
+
512
  *Effects:* If `parray` is a null pointer, allocates an array of pointers
513
  to `void` of unspecified size and stores a pointer to its first element
514
  in `parray`. The function then extends the array pointed at by `parray`
515
  as necessary to include the element `parray[idx]`. Each newly allocated
516
  element of the array is initialized to a null pointer. The reference
 
526
  initialized to 0.
527
 
528
  *Remarks:* After a subsequent call to `pword(int)` for the same object,
529
  the earlier return value may no longer be valid.
530
 
531
+ #### Callbacks <a id="ios.base.callback">[[ios.base.callback]]</a>
532
 
533
  ``` cpp
534
+ void register_callback(event_callback fn, int idx);
535
  ```
536
 
537
+ *Preconditions:* The function `fn` does not throw exceptions.
 
 
 
 
 
538
 
539
+ *Effects:* Registers the pair `(fn, idx)` such that during calls to
540
+ `imbue()` [[ios.base.locales]], `copyfmt()`, or `~ios_base()`
541
+ [[ios.base.cons]], the function `fn` is called with argument `idx`.
542
+ Functions registered are called when an event occurs, in opposite order
543
+ of registration. Functions registered while a callback function is
544
+ active are not called until the next event.
545
 
546
  *Remarks:* Identical pairs are not merged. A function registered twice
547
  will be called twice.
548
 
549
+ #### Constructors and destructor <a id="ios.base.cons">[[ios.base.cons]]</a>
550
 
551
  ``` cpp
552
  ios_base();
553
  ```
554
 
 
559
 
560
  ``` cpp
561
  ~ios_base();
562
  ```
563
 
564
+ *Effects:* Calls each registered callback pair `(fn, idx)`
565
+ [[ios.base.callback]] as `(*fn)(erase_event, *this, idx)` at such time
566
+ that any `ios_base` member function called from within `fn` has
567
+ well-defined results.
568