summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2022-05-10 13:06:47 +0100
committerJonathan Wakely <jwakely@redhat.com>2022-05-10 16:40:22 +0100
commitca97c87758d450a946cac31b0db43da0039fabf1 (patch)
tree6ac24fa447a908c26fbd545407775639edb01f0f /libstdc++-v3
parentlibstdc++: Add <syncstream> declarations to <iosfwd> [PR105284] (diff)
downloadgcc-ca97c87758d450a946cac31b0db43da0039fabf1.tar.gz
gcc-ca97c87758d450a946cac31b0db43da0039fabf1.tar.bz2
gcc-ca97c87758d450a946cac31b0db43da0039fabf1.tar.xz
libstdc++: Add <spanstream> declarations to <iosfwd> [PR105284]
libstdc++-v3/ChangeLog: PR libstdc++/105284 * include/std/iosfwd: Add declarations for <spanstream> class templates and typedefs. * include/std/spanstream (basic_spanbuf, basic_ispanstream) (basic_ospanstream, basic_spanstream): Remove default template arguments. * testsuite/27_io/headers/iosfwd/synopsis.cc: Add <spanstream> declarations. * testsuite/27_io/headers/iosfwd/types.cc: Check <spanstream> default arguments.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/include/std/iosfwd23
-rw-r--r--libstdc++-v3/include/std/spanstream8
-rw-r--r--libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc13
-rw-r--r--libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc50
4 files changed, 90 insertions, 4 deletions
diff --git a/libstdc++-v3/include/std/iosfwd b/libstdc++-v3/include/std/iosfwd
index c8c67c86c3b..ddf0c953856 100644
--- a/libstdc++-v3/include/std/iosfwd
+++ b/libstdc++-v3/include/std/iosfwd
@@ -225,6 +225,29 @@ _GLIBCXX_END_NAMESPACE_CXX11
225#endif 225#endif
226#endif // C++20 && CXX11_ABI 226#endif // C++20 && CXX11_ABI
227 227
228#if __cplusplus > 202002L
229 template<typename _CharT, typename _Traits = char_traits<_CharT>>
230 class basic_spanbuf;
231 template<typename _CharT, typename _Traits = char_traits<_CharT>>
232 class basic_ispanstream;
233 template<typename _CharT, typename _Traits = char_traits<_CharT>>
234 class basic_ospanstream;
235 template<typename _CharT, typename _Traits = char_traits<_CharT>>
236 class basic_spanstream;
237
238 using spanbuf = basic_spanbuf<char>;
239 using ispanstream = basic_ispanstream<char>;
240 using ospanstream = basic_ospanstream<char>;
241 using spanstream = basic_spanstream<char>;
242
243#ifdef _GLIBCXX_USE_WCHAR_T
244 using wspanbuf = basic_spanbuf<wchar_t>;
245 using wispanstream = basic_ispanstream<wchar_t>;
246 using wospanstream = basic_ospanstream<wchar_t>;
247 using wspanstream = basic_spanstream<wchar_t>;
248#endif
249#endif // C++23
250
228 /** @} */ 251 /** @} */
229 252
230_GLIBCXX_END_NAMESPACE_VERSION 253_GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/spanstream b/libstdc++-v3/include/std/spanstream
index 000bda52a1e..5855b286efe 100644
--- a/libstdc++-v3/include/std/spanstream
+++ b/libstdc++-v3/include/std/spanstream
@@ -45,7 +45,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
45 45
46#define __cpp_lib_spanstream 202106L 46#define __cpp_lib_spanstream 202106L
47 47
48template<typename _CharT, typename _Traits = char_traits<_CharT>> 48template<typename _CharT, typename _Traits>
49 class basic_spanbuf 49 class basic_spanbuf
50 : public basic_streambuf<_CharT, _Traits> 50 : public basic_streambuf<_CharT, _Traits>
51 { 51 {
@@ -218,7 +218,7 @@ template<typename _CharT, typename _Traits>
218using spanbuf = basic_spanbuf<char>; 218using spanbuf = basic_spanbuf<char>;
219using wspanbuf = basic_spanbuf<wchar_t>; 219using wspanbuf = basic_spanbuf<wchar_t>;
220 220
221template<typename _CharT, typename _Traits = char_traits<_CharT>> 221template<typename _CharT, typename _Traits>
222 class basic_ispanstream 222 class basic_ispanstream
223 : public basic_istream<_CharT, _Traits> 223 : public basic_istream<_CharT, _Traits>
224 { 224 {
@@ -310,7 +310,7 @@ template<typename _CharT, typename _Traits>
310using ispanstream = basic_ispanstream<char>; 310using ispanstream = basic_ispanstream<char>;
311using wispanstream = basic_ispanstream<wchar_t>; 311using wispanstream = basic_ispanstream<wchar_t>;
312 312
313template<typename _CharT, typename _Traits = char_traits<_CharT>> 313template<typename _CharT, typename _Traits>
314 class basic_ospanstream 314 class basic_ospanstream
315 : public basic_ostream<_CharT, _Traits> 315 : public basic_ostream<_CharT, _Traits>
316 { 316 {
@@ -378,7 +378,7 @@ template<typename _CharT, typename _Traits>
378using ospanstream = basic_ospanstream<char>; 378using ospanstream = basic_ospanstream<char>;
379using wospanstream = basic_ospanstream<wchar_t>; 379using wospanstream = basic_ospanstream<wchar_t>;
380 380
381template<typename _CharT, typename _Traits = char_traits<_CharT>> 381template<typename _CharT, typename _Traits>
382 class basic_spanstream 382 class basic_spanstream
383 : public basic_iostream<_CharT, _Traits> 383 : public basic_iostream<_CharT, _Traits>
384 { 384 {
diff --git a/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc
index 48f733bf28a..467d63609bd 100644
--- a/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc
+++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/synopsis.cc
@@ -75,6 +75,12 @@ _GLIBCXX_END_NAMESPACE_CXX11
75 typedef basic_ostringstream<char> ostringstream; 75 typedef basic_ostringstream<char> ostringstream;
76 typedef basic_stringstream<char> stringstream; 76 typedef basic_stringstream<char> stringstream;
77 77
78#if __cplusplus > 202002L
79 typedef basic_spanbuf<char> spanbuf;
80 typedef basic_ispanstream<char> ispanstream;
81 typedef basic_ospanstream<char> ospanstream;
82 typedef basic_spanstream<char> spanstream;
83#endif
78 84
79 typedef basic_filebuf<char> filebuf; 85 typedef basic_filebuf<char> filebuf;
80 typedef basic_ifstream<char> ifstream; 86 typedef basic_ifstream<char> ifstream;
@@ -96,6 +102,13 @@ _GLIBCXX_END_NAMESPACE_CXX11
96 typedef basic_ostringstream<wchar_t> wostringstream; 102 typedef basic_ostringstream<wchar_t> wostringstream;
97 typedef basic_stringstream<wchar_t> wstringstream; 103 typedef basic_stringstream<wchar_t> wstringstream;
98 104
105#if __cplusplus > 202002L
106 typedef basic_spanbuf<wchar_t> wspanbuf;
107 typedef basic_ispanstream<wchar_t> wispanstream;
108 typedef basic_ospanstream<wchar_t> wospanstream;
109 typedef basic_spanstream<wchar_t> wspanstream;
110#endif
111
99 typedef basic_filebuf<wchar_t> wfilebuf; 112 typedef basic_filebuf<wchar_t> wfilebuf;
100 typedef basic_ifstream<wchar_t> wifstream; 113 typedef basic_ifstream<wchar_t> wifstream;
101 typedef basic_ofstream<wchar_t> wofstream; 114 typedef basic_ofstream<wchar_t> wofstream;
diff --git a/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc b/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc
index e2c9c9b8dfa..baf37e910af 100644
--- a/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc
+++ b/libstdc++-v3/testsuite/27_io/headers/iosfwd/types.cc
@@ -115,6 +115,56 @@ static_assert(Same<basic_stringstream<wchar_t>,
115 >::value, 115 >::value,
116 "std::basic_stringstream<wchar_t> has the correct default template argument"); 116 "std::basic_stringstream<wchar_t> has the correct default template argument");
117 117
118#if __cplusplus > 202002L
119using std::basic_spanbuf;
120
121static_assert(Same<basic_spanbuf<char>,
122 basic_spanbuf<char, Traits<char>>
123 >::value,
124 "std::basic_spanbuf<char> has the correct default template argument");
125
126static_assert(Same<basic_spanbuf<wchar_t>,
127 basic_spanbuf<wchar_t, Traits<wchar_t>>
128 >::value,
129 "std::basic_spanbuf<wchar_t> has the correct default template argument");
130
131using std::basic_ispanstream;
132
133static_assert(Same<basic_ispanstream<char>,
134 basic_ispanstream<char, Traits<char>>
135 >::value,
136 "std::basic_ispanstream<char> has the correct default template argument");
137
138static_assert(Same<basic_ispanstream<wchar_t>,
139 basic_ispanstream<wchar_t, Traits<wchar_t>>
140 >::value,
141 "std::basic_ispanstream<wchar_t> has the correct default template argument");
142
143using std::basic_ospanstream;
144
145static_assert(Same<basic_ospanstream<char>,
146 basic_ospanstream<char, Traits<char>>
147 >::value,
148 "std::basic_ospanstream<char> has the correct default template argument");
149
150static_assert(Same<basic_ospanstream<wchar_t>,
151 basic_ospanstream<wchar_t, Traits<wchar_t>>
152 >::value,
153 "std::basic_ospanstream<wchar_t> has the correct default template argument");
154
155using std::basic_spanstream;
156
157static_assert(Same<basic_spanstream<char>,
158 basic_spanstream<char, Traits<char>>
159 >::value,
160 "std::basic_spanstream<char> has the correct default template argument");
161
162static_assert(Same<basic_spanstream<wchar_t>,
163 basic_spanstream<wchar_t, Traits<wchar_t>>
164 >::value,
165 "std::basic_spanstream<wchar_t> has the correct default template argument");
166#endif
167
118using std::basic_filebuf; 168using std::basic_filebuf;
119 169
120static_assert(Same<basic_filebuf<char>, 170static_assert(Same<basic_filebuf<char>,