tmp/tmpexu54k_1/{from.md → to.md}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
## Forward declarations <a id="iostream.forward">[[iostream.forward]]</a>
|
| 2 |
|
|
|
|
|
|
|
| 3 |
``` cpp
|
| 4 |
namespace std {
|
| 5 |
template<class charT> class char_traits;
|
| 6 |
template<> class char_traits<char>;
|
| 7 |
template<> class char_traits<char16_t>;
|
|
@@ -46,61 +48,63 @@ namespace std {
|
|
| 46 |
template <class charT, class traits = char_traits<charT>>
|
| 47 |
class istreambuf_iterator;
|
| 48 |
template <class charT, class traits = char_traits<charT>>
|
| 49 |
class ostreambuf_iterator;
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
|
| 84 |
template <class state> class fpos;
|
| 85 |
-
|
| 86 |
-
|
| 87 |
}
|
| 88 |
```
|
| 89 |
|
| 90 |
Default template arguments are described as appearing both in `<iosfwd>`
|
| 91 |
and in the synopsis of other headers but it is well-formed to include
|
| 92 |
both `<iosfwd>` and one or more of the other headers.[^1]
|
| 93 |
|
|
|
|
|
|
|
| 94 |
The class template specialization `basic_ios<charT, traits>` serves as a
|
| 95 |
virtual base class for the class templates `basic_istream`,
|
| 96 |
`basic_ostream`, and class templates derived from them. `basic_iostream`
|
| 97 |
is a class template derived from both `basic_istream<charT, traits>` and
|
| 98 |
`basic_ostream<charT, traits>`.
|
| 99 |
|
| 100 |
-
The class template specialization `basic_streambuf<charT,traits>`
|
| 101 |
-
as a base class for class templates `basic_stringbuf` and
|
| 102 |
`basic_filebuf`.
|
| 103 |
|
| 104 |
The class template specialization `basic_istream<charT, traits>` serves
|
| 105 |
as a base class for class templates `basic_istringstream` and
|
| 106 |
`basic_ifstream`.
|
|
@@ -111,30 +115,33 @@ as a base class for class templates `basic_ostringstream` and
|
|
| 111 |
|
| 112 |
The class template specialization `basic_iostream<charT, traits>` serves
|
| 113 |
as a base class for class templates `basic_stringstream` and
|
| 114 |
`basic_fstream`.
|
| 115 |
|
| 116 |
-
Other
|
| 117 |
-
`char` or `wchar_t` types.
|
| 118 |
|
| 119 |
Specializations of the class template `fpos` are used for specifying
|
| 120 |
file position information.
|
| 121 |
|
| 122 |
The types `streampos` and `wstreampos` are used for positioning streams
|
| 123 |
specialized on `char` and `wchar_t` respectively.
|
| 124 |
|
|
|
|
|
|
|
| 125 |
This synopsis suggests a circularity between `streampos` and
|
| 126 |
`char_traits<char>`. An implementation can avoid this circularity by
|
| 127 |
substituting equivalent types. One way to do this might be
|
| 128 |
|
| 129 |
``` cpp
|
| 130 |
template<class stateT> class fpos { ... }; // depends on nothing
|
| 131 |
-
|
| 132 |
|
| 133 |
-
|
| 134 |
|
| 135 |
template<> struct char_traits<char> {
|
| 136 |
-
|
| 137 |
-
pos_type;
|
| 138 |
}
|
| 139 |
```
|
| 140 |
|
|
|
|
|
|
|
|
|
| 1 |
## Forward declarations <a id="iostream.forward">[[iostream.forward]]</a>
|
| 2 |
|
| 3 |
+
### Header `<iosfwd>` synopsis <a id="iosfwd.syn">[[iosfwd.syn]]</a>
|
| 4 |
+
|
| 5 |
``` cpp
|
| 6 |
namespace std {
|
| 7 |
template<class charT> class char_traits;
|
| 8 |
template<> class char_traits<char>;
|
| 9 |
template<> class char_traits<char16_t>;
|
|
|
|
| 48 |
template <class charT, class traits = char_traits<charT>>
|
| 49 |
class istreambuf_iterator;
|
| 50 |
template <class charT, class traits = char_traits<charT>>
|
| 51 |
class ostreambuf_iterator;
|
| 52 |
|
| 53 |
+
using ios = basic_ios<char>;
|
| 54 |
+
using wios = basic_ios<wchar_t>;
|
| 55 |
|
| 56 |
+
using streambuf = basic_streambuf<char>;
|
| 57 |
+
using istream = basic_istream<char>;
|
| 58 |
+
using ostream = basic_ostream<char>;
|
| 59 |
+
using iostream = basic_iostream<char>;
|
| 60 |
|
| 61 |
+
using stringbuf = basic_stringbuf<char>;
|
| 62 |
+
using istringstream = basic_istringstream<char>;
|
| 63 |
+
using ostringstream = basic_ostringstream<char>;
|
| 64 |
+
using stringstream = basic_stringstream<char>;
|
| 65 |
|
| 66 |
+
using filebuf = basic_filebuf<char>;
|
| 67 |
+
using ifstream = basic_ifstream<char>;
|
| 68 |
+
using ofstream = basic_ofstream<char>;
|
| 69 |
+
using fstream = basic_fstream<char>;
|
| 70 |
|
| 71 |
+
using wstreambuf = basic_streambuf<wchar_t>;
|
| 72 |
+
using wistream = basic_istream<wchar_t>;
|
| 73 |
+
using wostream = basic_ostream<wchar_t>;
|
| 74 |
+
using wiostream = basic_iostream<wchar_t>;
|
| 75 |
|
| 76 |
+
using wstringbuf = basic_stringbuf<wchar_t>;
|
| 77 |
+
using wistringstream = basic_istringstream<wchar_t>;
|
| 78 |
+
using wostringstream = basic_ostringstream<wchar_t>;
|
| 79 |
+
using wstringstream = basic_stringstream<wchar_t>;
|
| 80 |
|
| 81 |
+
using wfilebuf = basic_filebuf<wchar_t>;
|
| 82 |
+
using wifstream = basic_ifstream<wchar_t>;
|
| 83 |
+
using wofstream = basic_ofstream<wchar_t>;
|
| 84 |
+
using wfstream = basic_fstream<wchar_t>;
|
| 85 |
|
| 86 |
template <class state> class fpos;
|
| 87 |
+
using streampos = fpos<char_traits<char>::state_type>;
|
| 88 |
+
using wstreampos = fpos<char_traits<wchar_t>::state_type>;
|
| 89 |
}
|
| 90 |
```
|
| 91 |
|
| 92 |
Default template arguments are described as appearing both in `<iosfwd>`
|
| 93 |
and in the synopsis of other headers but it is well-formed to include
|
| 94 |
both `<iosfwd>` and one or more of the other headers.[^1]
|
| 95 |
|
| 96 |
+
### Overview <a id="iostream.forward.overview">[[iostream.forward.overview]]</a>
|
| 97 |
+
|
| 98 |
The class template specialization `basic_ios<charT, traits>` serves as a
|
| 99 |
virtual base class for the class templates `basic_istream`,
|
| 100 |
`basic_ostream`, and class templates derived from them. `basic_iostream`
|
| 101 |
is a class template derived from both `basic_istream<charT, traits>` and
|
| 102 |
`basic_ostream<charT, traits>`.
|
| 103 |
|
| 104 |
+
The class template specialization `basic_streambuf<charT, traits>`
|
| 105 |
+
serves as a base class for class templates `basic_stringbuf` and
|
| 106 |
`basic_filebuf`.
|
| 107 |
|
| 108 |
The class template specialization `basic_istream<charT, traits>` serves
|
| 109 |
as a base class for class templates `basic_istringstream` and
|
| 110 |
`basic_ifstream`.
|
|
|
|
| 115 |
|
| 116 |
The class template specialization `basic_iostream<charT, traits>` serves
|
| 117 |
as a base class for class templates `basic_stringstream` and
|
| 118 |
`basic_fstream`.
|
| 119 |
|
| 120 |
+
Other *typedef-name*s define instances of class templates specialized
|
| 121 |
+
for `char` or `wchar_t` types.
|
| 122 |
|
| 123 |
Specializations of the class template `fpos` are used for specifying
|
| 124 |
file position information.
|
| 125 |
|
| 126 |
The types `streampos` and `wstreampos` are used for positioning streams
|
| 127 |
specialized on `char` and `wchar_t` respectively.
|
| 128 |
|
| 129 |
+
[*Note 1*:
|
| 130 |
+
|
| 131 |
This synopsis suggests a circularity between `streampos` and
|
| 132 |
`char_traits<char>`. An implementation can avoid this circularity by
|
| 133 |
substituting equivalent types. One way to do this might be
|
| 134 |
|
| 135 |
``` cpp
|
| 136 |
template<class stateT> class fpos { ... }; // depends on nothing
|
| 137 |
+
using _STATE = ... ; // implementation private declaration of stateT
|
| 138 |
|
| 139 |
+
using streampos = fpos<_STATE>;
|
| 140 |
|
| 141 |
template<> struct char_traits<char> {
|
| 142 |
+
using pos_type = streampos;
|
|
|
|
| 143 |
}
|
| 144 |
```
|
| 145 |
|
| 146 |
+
— *end note*]
|
| 147 |
+
|