tmp/tmpbkxjc13i/{from.md → to.md}
RENAMED
|
@@ -4,15 +4,19 @@
|
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
#include <iosfwd> // see [iosfwd.syn]
|
| 7 |
|
| 8 |
namespace std {
|
|
|
|
| 9 |
using streamoff = implementation-defined;
|
| 10 |
using streamsize = implementation-defined;
|
|
|
|
| 11 |
template<class stateT> class fpos;
|
| 12 |
|
|
|
|
| 13 |
class ios_base;
|
|
|
|
| 14 |
template<class charT, class traits = char_traits<charT>>
|
| 15 |
class basic_ios;
|
| 16 |
|
| 17 |
// [std.ios.manip], manipulators
|
| 18 |
ios_base& boolalpha (ios_base& str);
|
|
@@ -214,11 +218,11 @@ namespace std {
|
|
| 214 |
An implementation is permitted to define `ios_base::failure` as a
|
| 215 |
synonym for a class with equivalent functionality to class
|
| 216 |
`ios_base::failure` shown in this subclause.
|
| 217 |
|
| 218 |
[*Note 1*: When `ios_base::failure` is a synonym for another type, that
|
| 219 |
-
type
|
| 220 |
injected-class-name. — *end note*]
|
| 221 |
|
| 222 |
The class `failure` defines the base class for the types of all objects
|
| 223 |
thrown as exceptions, by functions in the iostreams library, to report
|
| 224 |
errors detected during stream buffer operations.
|
|
@@ -358,27 +362,19 @@ namespace std {
|
|
| 358 |
public:
|
| 359 |
Init();
|
| 360 |
Init(const Init&) = default;
|
| 361 |
~Init();
|
| 362 |
Init& operator=(const Init&) = default;
|
| 363 |
-
|
| 364 |
-
private:
|
| 365 |
-
static int init_cnt; // exposition only
|
| 366 |
};
|
| 367 |
}
|
| 368 |
```
|
| 369 |
|
| 370 |
The class `Init` describes an object whose construction ensures the
|
| 371 |
construction of the eight objects declared in `<iostream>`
|
| 372 |
[[iostream.objects]] that associate file stream buffers with the
|
| 373 |
standard C streams provided for by the functions declared in `<cstdio>`.
|
| 374 |
|
| 375 |
-
For the sake of exposition, the maintained data is presented here as:
|
| 376 |
-
|
| 377 |
-
- `static int init_cnt`, counts the number of constructor and destructor
|
| 378 |
-
calls for class `Init`, initialized to zero.
|
| 379 |
-
|
| 380 |
``` cpp
|
| 381 |
Init();
|
| 382 |
```
|
| 383 |
|
| 384 |
*Effects:* Constructs and initializes the objects `cin`, `cout`, `cerr`,
|
|
@@ -545,25 +541,25 @@ for any sequence of characters.[^5]
|
|
| 545 |
|
| 546 |
``` cpp
|
| 547 |
static int xalloc();
|
| 548 |
```
|
| 549 |
|
| 550 |
-
*Returns:*
|
| 551 |
|
| 552 |
*Remarks:* Concurrent access to this function by multiple threads does
|
| 553 |
not result in a data race [[intro.multithread]].
|
| 554 |
|
| 555 |
``` cpp
|
| 556 |
long& iword(int idx);
|
| 557 |
```
|
| 558 |
|
| 559 |
*Preconditions:* `idx` is a value obtained by a call to `xalloc`.
|
| 560 |
|
| 561 |
-
*Effects:* If
|
| 562 |
of unspecified size and stores a pointer to its first element in
|
| 563 |
-
|
| 564 |
-
necessary to include the element `iarray[idx]`. Each newly allocated
|
| 565 |
element of the array is initialized to zero. The reference returned is
|
| 566 |
invalid after any other operation on the object.[^6]
|
| 567 |
|
| 568 |
However, the value of the storage referred to is retained, so that until
|
| 569 |
the next call to `copyfmt`, calling `iword` with the same index yields
|
|
@@ -572,28 +568,28 @@ another reference to the same value. If the function fails[^7]
|
|
| 572 |
and `*this` is a base class subobject of a `basic_ios<>` object or
|
| 573 |
subobject, the effect is equivalent to calling
|
| 574 |
`basic_ios<>::setstate(badbit)` on the derived object (which may throw
|
| 575 |
`failure`).
|
| 576 |
|
| 577 |
-
*Returns:* On success `iarray[idx]`. On failure, a valid `long&`
|
| 578 |
initialized to 0.
|
| 579 |
|
| 580 |
``` cpp
|
| 581 |
void*& pword(int idx);
|
| 582 |
```
|
| 583 |
|
| 584 |
*Preconditions:* `idx` is a value obtained by a call to `xalloc`.
|
| 585 |
|
| 586 |
-
*Effects:* If
|
| 587 |
to `void` of unspecified size and stores a pointer to its first element
|
| 588 |
-
in
|
| 589 |
-
as necessary to include the element `parray[idx]`. Each newly
|
| 590 |
-
element of the array is initialized to a null pointer. The
|
| 591 |
-
returned is invalid after any other operation on the object.
|
| 592 |
-
the value of the storage referred to is retained, so that until
|
| 593 |
-
call to `copyfmt`, calling `pword` with the same index yields
|
| 594 |
-
reference to the same value. If the function fails[^8]
|
| 595 |
|
| 596 |
and `*this` is a base class subobject of a `basic_ios<>` object or
|
| 597 |
subobject, the effect is equivalent to calling
|
| 598 |
`basic_ios<>::setstate(badbit)` on the derived object (which may throw
|
| 599 |
`failure`).
|
|
@@ -642,10 +638,12 @@ destroyed, whichever comes first; otherwise the behavior is undefined.
|
|
| 642 |
that any `ios_base` member function called from within `fn` has
|
| 643 |
well-defined results. Then, any memory obtained is deallocated.
|
| 644 |
|
| 645 |
### Class template `fpos` <a id="fpos">[[fpos]]</a>
|
| 646 |
|
|
|
|
|
|
|
| 647 |
``` cpp
|
| 648 |
namespace std {
|
| 649 |
template<class stateT> class fpos {
|
| 650 |
public:
|
| 651 |
// [fpos.members], members
|
|
@@ -662,17 +660,17 @@ namespace std {
|
|
| 662 |
|
| 663 |
``` cpp
|
| 664 |
void state(stateT s);
|
| 665 |
```
|
| 666 |
|
| 667 |
-
*Effects:* Assigns `s` to
|
| 668 |
|
| 669 |
``` cpp
|
| 670 |
stateT state() const;
|
| 671 |
```
|
| 672 |
|
| 673 |
-
*Returns:* Current value of
|
| 674 |
|
| 675 |
#### Requirements <a id="fpos.operations">[[fpos.operations]]</a>
|
| 676 |
|
| 677 |
An `fpos` type specifies file position information. It holds a state
|
| 678 |
object whose type is equal to the template parameter `stateT`. Type
|
|
@@ -713,13 +711,13 @@ function is undefined.
|
|
| 713 |
namespace std {
|
| 714 |
template<class charT, class traits = char_traits<charT>>
|
| 715 |
class basic_ios : public ios_base {
|
| 716 |
public:
|
| 717 |
using char_type = charT;
|
| 718 |
-
using int_type =
|
| 719 |
-
using pos_type =
|
| 720 |
-
using off_type =
|
| 721 |
using traits_type = traits;
|
| 722 |
|
| 723 |
// [iostate.flags], flags functions
|
| 724 |
explicit operator bool() const;
|
| 725 |
bool operator!() const;
|
|
@@ -865,17 +863,17 @@ locale imbue(const locale& loc);
|
|
| 865 |
|
| 866 |
``` cpp
|
| 867 |
char narrow(char_type c, char dfault) const;
|
| 868 |
```
|
| 869 |
|
| 870 |
-
*Returns:* `use_facet<ctype<char_type>>(getloc()).narrow(c, dfault)`
|
| 871 |
|
| 872 |
``` cpp
|
| 873 |
char_type widen(char c) const;
|
| 874 |
```
|
| 875 |
|
| 876 |
-
*Returns:* `use_facet<ctype<char_type>>(getloc()).widen(c)`
|
| 877 |
|
| 878 |
``` cpp
|
| 879 |
char_type fill() const;
|
| 880 |
```
|
| 881 |
|
|
@@ -1011,11 +1009,11 @@ void setstate(iostate state);
|
|
| 1011 |
|
| 1012 |
``` cpp
|
| 1013 |
bool good() const;
|
| 1014 |
```
|
| 1015 |
|
| 1016 |
-
*Returns:* `rdstate() == 0`
|
| 1017 |
|
| 1018 |
``` cpp
|
| 1019 |
bool eof() const;
|
| 1020 |
```
|
| 1021 |
|
|
|
|
| 4 |
|
| 5 |
``` cpp
|
| 6 |
#include <iosfwd> // see [iosfwd.syn]
|
| 7 |
|
| 8 |
namespace std {
|
| 9 |
+
// [stream.types], types
|
| 10 |
using streamoff = implementation-defined;
|
| 11 |
using streamsize = implementation-defined;
|
| 12 |
+
// [fpos], class template fpos
|
| 13 |
template<class stateT> class fpos;
|
| 14 |
|
| 15 |
+
// [ios.base], class ios_base
|
| 16 |
class ios_base;
|
| 17 |
+
// [ios], class template basic_ios
|
| 18 |
template<class charT, class traits = char_traits<charT>>
|
| 19 |
class basic_ios;
|
| 20 |
|
| 21 |
// [std.ios.manip], manipulators
|
| 22 |
ios_base& boolalpha (ios_base& str);
|
|
|
|
| 218 |
An implementation is permitted to define `ios_base::failure` as a
|
| 219 |
synonym for a class with equivalent functionality to class
|
| 220 |
`ios_base::failure` shown in this subclause.
|
| 221 |
|
| 222 |
[*Note 1*: When `ios_base::failure` is a synonym for another type, that
|
| 223 |
+
type needs to provide a nested type `failure` to emulate the
|
| 224 |
injected-class-name. — *end note*]
|
| 225 |
|
| 226 |
The class `failure` defines the base class for the types of all objects
|
| 227 |
thrown as exceptions, by functions in the iostreams library, to report
|
| 228 |
errors detected during stream buffer operations.
|
|
|
|
| 362 |
public:
|
| 363 |
Init();
|
| 364 |
Init(const Init&) = default;
|
| 365 |
~Init();
|
| 366 |
Init& operator=(const Init&) = default;
|
|
|
|
|
|
|
|
|
|
| 367 |
};
|
| 368 |
}
|
| 369 |
```
|
| 370 |
|
| 371 |
The class `Init` describes an object whose construction ensures the
|
| 372 |
construction of the eight objects declared in `<iostream>`
|
| 373 |
[[iostream.objects]] that associate file stream buffers with the
|
| 374 |
standard C streams provided for by the functions declared in `<cstdio>`.
|
| 375 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
``` cpp
|
| 377 |
Init();
|
| 378 |
```
|
| 379 |
|
| 380 |
*Effects:* Constructs and initializes the objects `cin`, `cout`, `cerr`,
|
|
|
|
| 541 |
|
| 542 |
``` cpp
|
| 543 |
static int xalloc();
|
| 544 |
```
|
| 545 |
|
| 546 |
+
*Returns:* *index* `++`.
|
| 547 |
|
| 548 |
*Remarks:* Concurrent access to this function by multiple threads does
|
| 549 |
not result in a data race [[intro.multithread]].
|
| 550 |
|
| 551 |
``` cpp
|
| 552 |
long& iword(int idx);
|
| 553 |
```
|
| 554 |
|
| 555 |
*Preconditions:* `idx` is a value obtained by a call to `xalloc`.
|
| 556 |
|
| 557 |
+
*Effects:* If *iarray* is a null pointer, allocates an array of `long`
|
| 558 |
of unspecified size and stores a pointer to its first element in
|
| 559 |
+
*iarray*. The function then extends the array pointed at by *iarray* as
|
| 560 |
+
necessary to include the element *`iarray`*`[idx]`. Each newly allocated
|
| 561 |
element of the array is initialized to zero. The reference returned is
|
| 562 |
invalid after any other operation on the object.[^6]
|
| 563 |
|
| 564 |
However, the value of the storage referred to is retained, so that until
|
| 565 |
the next call to `copyfmt`, calling `iword` with the same index yields
|
|
|
|
| 568 |
and `*this` is a base class subobject of a `basic_ios<>` object or
|
| 569 |
subobject, the effect is equivalent to calling
|
| 570 |
`basic_ios<>::setstate(badbit)` on the derived object (which may throw
|
| 571 |
`failure`).
|
| 572 |
|
| 573 |
+
*Returns:* On success *`iarray`*`[idx]`. On failure, a valid `long&`
|
| 574 |
initialized to 0.
|
| 575 |
|
| 576 |
``` cpp
|
| 577 |
void*& pword(int idx);
|
| 578 |
```
|
| 579 |
|
| 580 |
*Preconditions:* `idx` is a value obtained by a call to `xalloc`.
|
| 581 |
|
| 582 |
+
*Effects:* If *parray* is a null pointer, allocates an array of pointers
|
| 583 |
to `void` of unspecified size and stores a pointer to its first element
|
| 584 |
+
in *parray*. The function then extends the array pointed at by *parray*
|
| 585 |
+
as necessary to include the element *`parray`*`[idx]`. Each newly
|
| 586 |
+
allocated element of the array is initialized to a null pointer. The
|
| 587 |
+
reference returned is invalid after any other operation on the object.
|
| 588 |
+
However, the value of the storage referred to is retained, so that until
|
| 589 |
+
the next call to `copyfmt`, calling `pword` with the same index yields
|
| 590 |
+
another reference to the same value. If the function fails[^8]
|
| 591 |
|
| 592 |
and `*this` is a base class subobject of a `basic_ios<>` object or
|
| 593 |
subobject, the effect is equivalent to calling
|
| 594 |
`basic_ios<>::setstate(badbit)` on the derived object (which may throw
|
| 595 |
`failure`).
|
|
|
|
| 638 |
that any `ios_base` member function called from within `fn` has
|
| 639 |
well-defined results. Then, any memory obtained is deallocated.
|
| 640 |
|
| 641 |
### Class template `fpos` <a id="fpos">[[fpos]]</a>
|
| 642 |
|
| 643 |
+
#### General <a id="fpos.general">[[fpos.general]]</a>
|
| 644 |
+
|
| 645 |
``` cpp
|
| 646 |
namespace std {
|
| 647 |
template<class stateT> class fpos {
|
| 648 |
public:
|
| 649 |
// [fpos.members], members
|
|
|
|
| 660 |
|
| 661 |
``` cpp
|
| 662 |
void state(stateT s);
|
| 663 |
```
|
| 664 |
|
| 665 |
+
*Effects:* Assigns `s` to *st*.
|
| 666 |
|
| 667 |
``` cpp
|
| 668 |
stateT state() const;
|
| 669 |
```
|
| 670 |
|
| 671 |
+
*Returns:* Current value of *st*.
|
| 672 |
|
| 673 |
#### Requirements <a id="fpos.operations">[[fpos.operations]]</a>
|
| 674 |
|
| 675 |
An `fpos` type specifies file position information. It holds a state
|
| 676 |
object whose type is equal to the template parameter `stateT`. Type
|
|
|
|
| 711 |
namespace std {
|
| 712 |
template<class charT, class traits = char_traits<charT>>
|
| 713 |
class basic_ios : public ios_base {
|
| 714 |
public:
|
| 715 |
using char_type = charT;
|
| 716 |
+
using int_type = traits::int_type;
|
| 717 |
+
using pos_type = traits::pos_type;
|
| 718 |
+
using off_type = traits::off_type;
|
| 719 |
using traits_type = traits;
|
| 720 |
|
| 721 |
// [iostate.flags], flags functions
|
| 722 |
explicit operator bool() const;
|
| 723 |
bool operator!() const;
|
|
|
|
| 863 |
|
| 864 |
``` cpp
|
| 865 |
char narrow(char_type c, char dfault) const;
|
| 866 |
```
|
| 867 |
|
| 868 |
+
*Returns:* `use_facet<ctype<char_type>>(getloc()).narrow(c, dfault)`.
|
| 869 |
|
| 870 |
``` cpp
|
| 871 |
char_type widen(char c) const;
|
| 872 |
```
|
| 873 |
|
| 874 |
+
*Returns:* `use_facet<ctype<char_type>>(getloc()).widen(c)`.
|
| 875 |
|
| 876 |
``` cpp
|
| 877 |
char_type fill() const;
|
| 878 |
```
|
| 879 |
|
|
|
|
| 1009 |
|
| 1010 |
``` cpp
|
| 1011 |
bool good() const;
|
| 1012 |
```
|
| 1013 |
|
| 1014 |
+
*Returns:* `rdstate() == 0`.
|
| 1015 |
|
| 1016 |
``` cpp
|
| 1017 |
bool eof() const;
|
| 1018 |
```
|
| 1019 |
|