From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed 2/2] libstdc++: Add <spanstream> declarations to <iosfwd> [PR105284]
Date: Tue, 10 May 2022 16:43:35 +0100 [thread overview]
Message-ID: <20220510154335.3714947-2-jwakely@redhat.com> (raw)
In-Reply-To: <20220510154335.3714947-1-jwakely@redhat.com>
Tested powerpc64le-linux, pushed to trunk.
-- >8 --
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.
---
libstdc++-v3/include/std/iosfwd | 23 +++++++++
libstdc++-v3/include/std/spanstream | 8 +--
| 13 +++++
| 50 +++++++++++++++++++
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
#endif
#endif // C++20 && CXX11_ABI
+#if __cplusplus > 202002L
+ template<typename _CharT, typename _Traits = char_traits<_CharT>>
+ class basic_spanbuf;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>>
+ class basic_ispanstream;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>>
+ class basic_ospanstream;
+ template<typename _CharT, typename _Traits = char_traits<_CharT>>
+ class basic_spanstream;
+
+ using spanbuf = basic_spanbuf<char>;
+ using ispanstream = basic_ispanstream<char>;
+ using ospanstream = basic_ospanstream<char>;
+ using spanstream = basic_spanstream<char>;
+
+#ifdef _GLIBCXX_USE_WCHAR_T
+ using wspanbuf = basic_spanbuf<wchar_t>;
+ using wispanstream = basic_ispanstream<wchar_t>;
+ using wospanstream = basic_ospanstream<wchar_t>;
+ using wspanstream = basic_spanstream<wchar_t>;
+#endif
+#endif // C++23
+
/** @} */
_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
#define __cpp_lib_spanstream 202106L
-template<typename _CharT, typename _Traits = char_traits<_CharT>>
+template<typename _CharT, typename _Traits>
class basic_spanbuf
: public basic_streambuf<_CharT, _Traits>
{
@@ -218,7 +218,7 @@ template<typename _CharT, typename _Traits>
using spanbuf = basic_spanbuf<char>;
using wspanbuf = basic_spanbuf<wchar_t>;
-template<typename _CharT, typename _Traits = char_traits<_CharT>>
+template<typename _CharT, typename _Traits>
class basic_ispanstream
: public basic_istream<_CharT, _Traits>
{
@@ -310,7 +310,7 @@ template<typename _CharT, typename _Traits>
using ispanstream = basic_ispanstream<char>;
using wispanstream = basic_ispanstream<wchar_t>;
-template<typename _CharT, typename _Traits = char_traits<_CharT>>
+template<typename _CharT, typename _Traits>
class basic_ospanstream
: public basic_ostream<_CharT, _Traits>
{
@@ -378,7 +378,7 @@ template<typename _CharT, typename _Traits>
using ospanstream = basic_ospanstream<char>;
using wospanstream = basic_ospanstream<wchar_t>;
-template<typename _CharT, typename _Traits = char_traits<_CharT>>
+template<typename _CharT, typename _Traits>
class basic_spanstream
: public basic_iostream<_CharT, _Traits>
{
--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
typedef basic_ostringstream<char> ostringstream;
typedef basic_stringstream<char> stringstream;
+#if __cplusplus > 202002L
+ typedef basic_spanbuf<char> spanbuf;
+ typedef basic_ispanstream<char> ispanstream;
+ typedef basic_ospanstream<char> ospanstream;
+ typedef basic_spanstream<char> spanstream;
+#endif
typedef basic_filebuf<char> filebuf;
typedef basic_ifstream<char> ifstream;
@@ -96,6 +102,13 @@ _GLIBCXX_END_NAMESPACE_CXX11
typedef basic_ostringstream<wchar_t> wostringstream;
typedef basic_stringstream<wchar_t> wstringstream;
+#if __cplusplus > 202002L
+ typedef basic_spanbuf<wchar_t> wspanbuf;
+ typedef basic_ispanstream<wchar_t> wispanstream;
+ typedef basic_ospanstream<wchar_t> wospanstream;
+ typedef basic_spanstream<wchar_t> wspanstream;
+#endif
+
typedef basic_filebuf<wchar_t> wfilebuf;
typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
--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>,
>::value,
"std::basic_stringstream<wchar_t> has the correct default template argument");
+#if __cplusplus > 202002L
+using std::basic_spanbuf;
+
+static_assert(Same<basic_spanbuf<char>,
+ basic_spanbuf<char, Traits<char>>
+ >::value,
+ "std::basic_spanbuf<char> has the correct default template argument");
+
+static_assert(Same<basic_spanbuf<wchar_t>,
+ basic_spanbuf<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_spanbuf<wchar_t> has the correct default template argument");
+
+using std::basic_ispanstream;
+
+static_assert(Same<basic_ispanstream<char>,
+ basic_ispanstream<char, Traits<char>>
+ >::value,
+ "std::basic_ispanstream<char> has the correct default template argument");
+
+static_assert(Same<basic_ispanstream<wchar_t>,
+ basic_ispanstream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_ispanstream<wchar_t> has the correct default template argument");
+
+using std::basic_ospanstream;
+
+static_assert(Same<basic_ospanstream<char>,
+ basic_ospanstream<char, Traits<char>>
+ >::value,
+ "std::basic_ospanstream<char> has the correct default template argument");
+
+static_assert(Same<basic_ospanstream<wchar_t>,
+ basic_ospanstream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_ospanstream<wchar_t> has the correct default template argument");
+
+using std::basic_spanstream;
+
+static_assert(Same<basic_spanstream<char>,
+ basic_spanstream<char, Traits<char>>
+ >::value,
+ "std::basic_spanstream<char> has the correct default template argument");
+
+static_assert(Same<basic_spanstream<wchar_t>,
+ basic_spanstream<wchar_t, Traits<wchar_t>>
+ >::value,
+ "std::basic_spanstream<wchar_t> has the correct default template argument");
+#endif
+
using std::basic_filebuf;
static_assert(Same<basic_filebuf<char>,
--
2.34.1
prev parent reply other threads:[~2022-05-10 15:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-10 15:43 [committed 1/2] libstdc++: Add <syncstream> " Jonathan Wakely
2022-05-10 15:43 ` Jonathan Wakely [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220510154335.3714947-2-jwakely@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).