public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-4889] libstdc++: Reorder constructors in <sstream>
@ 2020-11-10 19:41 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2020-11-10 19:41 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:f7c41c572bbc16d852104515e506936d447debbe

commit r11-4889-gf7c41c572bbc16d852104515e506936d447debbe
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Nov 10 19:12:03 2020 +0000

    libstdc++: Reorder constructors in <sstream>
    
    This groups all the constructors together, consistent with the synopses
    in the C++20 standard.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/sstream (basic_stringbug, basic_istringstream)
            (basic_ostringstream, basic_stringstream): Reorder C++20
            constructors to be declared next to other constructors.

Diff:
---
 libstdc++-v3/include/std/sstream | 200 +++++++++++++++++++--------------------
 1 file changed, 100 insertions(+), 100 deletions(-)

diff --git a/libstdc++-v3/include/std/sstream b/libstdc++-v3/include/std/sstream
index 8cddda29701..d7200ab6ed8 100644
--- a/libstdc++-v3/include/std/sstream
+++ b/libstdc++-v3/include/std/sstream
@@ -149,37 +149,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       : basic_stringbuf(std::move(__rhs), __xfer_bufptrs(__rhs, this))
       { __rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0); }
 
-      // 27.8.2.2 Assign and swap:
-
-      basic_stringbuf&
-      operator=(const basic_stringbuf&) = delete;
-
-      basic_stringbuf&
-      operator=(basic_stringbuf&& __rhs)
-      {
-	__xfer_bufptrs __st{__rhs, this};
-	const __streambuf_type& __base = __rhs;
-	__streambuf_type::operator=(__base);
-	this->pubimbue(__rhs.getloc());
-	_M_mode = __rhs._M_mode;
-	_M_string = std::move(__rhs._M_string);
-	__rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0);
-	return *this;
-      }
-
-      void
-      swap(basic_stringbuf& __rhs) noexcept(_Noexcept_swap::value)
-      {
-	__xfer_bufptrs __l_st{*this, std::__addressof(__rhs)};
-	__xfer_bufptrs __r_st{__rhs, this};
-	__streambuf_type& __base = __rhs;
-	__streambuf_type::swap(__base);
-	__rhs.pubimbue(this->pubimbue(__rhs.getloc()));
-	std::swap(_M_mode, __rhs._M_mode);
-	std::swap(_M_string, __rhs._M_string); // XXX not exception safe
-      }
-#endif // C++11
-
 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
       explicit
       basic_stringbuf(const allocator_type& __a)
@@ -226,7 +195,38 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 
       allocator_type get_allocator() const noexcept
       { return _M_string.get_allocator(); }
-#endif
+#endif // C++20
+
+      // 27.8.2.2 Assign and swap:
+
+      basic_stringbuf&
+      operator=(const basic_stringbuf&) = delete;
+
+      basic_stringbuf&
+      operator=(basic_stringbuf&& __rhs)
+      {
+	__xfer_bufptrs __st{__rhs, this};
+	const __streambuf_type& __base = __rhs;
+	__streambuf_type::operator=(__base);
+	this->pubimbue(__rhs.getloc());
+	_M_mode = __rhs._M_mode;
+	_M_string = std::move(__rhs._M_string);
+	__rhs._M_sync(const_cast<char_type*>(__rhs._M_string.data()), 0, 0);
+	return *this;
+      }
+
+      void
+      swap(basic_stringbuf& __rhs) noexcept(_Noexcept_swap::value)
+      {
+	__xfer_bufptrs __l_st{*this, std::__addressof(__rhs)};
+	__xfer_bufptrs __r_st{__rhs, this};
+	__streambuf_type& __base = __rhs;
+	__streambuf_type::swap(__base);
+	__rhs.pubimbue(this->pubimbue(__rhs.getloc()));
+	std::swap(_M_mode, __rhs._M_mode);
+	std::swap(_M_string, __rhs._M_string); // XXX not exception safe
+      }
+#endif // C++11
 
       // Getters and setters:
 
@@ -282,7 +282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 	else
 	  return _M_string;
       }
-#endif
+#endif // C++20
 
       /**
        *  @brief  Setting a new buffer.
@@ -513,7 +513,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _M_mode(__rhs._M_mode), _M_string(std::move(__rhs._M_string), __a)
       { }
 #endif
-#endif
+#endif // C++11
     };
 
 
@@ -623,27 +623,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _M_stringbuf(std::move(__rhs._M_stringbuf))
       { __istream_type::set_rdbuf(&_M_stringbuf); }
 
-      // 27.8.3.2 Assign and swap:
-
-      basic_istringstream&
-      operator=(const basic_istringstream&) = delete;
-
-      basic_istringstream&
-      operator=(basic_istringstream&& __rhs)
-      {
-	__istream_type::operator=(std::move(__rhs));
-	_M_stringbuf = std::move(__rhs._M_stringbuf);
-	return *this;
-      }
-
-      void
-      swap(basic_istringstream& __rhs)
-      {
-	__istream_type::swap(__rhs);
-	_M_stringbuf.swap(__rhs._M_stringbuf);
-      }
-#endif
-
 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
       basic_istringstream(ios_base::openmode __mode, const allocator_type& __a)
       : __istream_type(), _M_stringbuf(__mode | ios_base::in, __a)
@@ -674,7 +653,28 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 			    ios_base::openmode __mode = ios_base::in)
 	: basic_istringstream(__str, __mode, allocator_type())
 	{ }
-#endif
+#endif // C++20
+
+      // 27.8.3.2 Assign and swap:
+
+      basic_istringstream&
+      operator=(const basic_istringstream&) = delete;
+
+      basic_istringstream&
+      operator=(basic_istringstream&& __rhs)
+      {
+	__istream_type::operator=(std::move(__rhs));
+	_M_stringbuf = std::move(__rhs._M_stringbuf);
+	return *this;
+      }
+
+      void
+      swap(basic_istringstream& __rhs)
+      {
+	__istream_type::swap(__rhs);
+	_M_stringbuf.swap(__rhs._M_stringbuf);
+      }
+#endif // C++11
 
       // Members:
       /**
@@ -844,27 +844,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _M_stringbuf(std::move(__rhs._M_stringbuf))
       { __ostream_type::set_rdbuf(&_M_stringbuf); }
 
-      // 27.8.3.2 Assign and swap:
-
-      basic_ostringstream&
-      operator=(const basic_ostringstream&) = delete;
-
-      basic_ostringstream&
-      operator=(basic_ostringstream&& __rhs)
-      {
-	__ostream_type::operator=(std::move(__rhs));
-	_M_stringbuf = std::move(__rhs._M_stringbuf);
-	return *this;
-      }
-
-      void
-      swap(basic_ostringstream& __rhs)
-      {
-	__ostream_type::swap(__rhs);
-	_M_stringbuf.swap(__rhs._M_stringbuf);
-      }
-#endif
-
 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
       basic_ostringstream(ios_base::openmode __mode, const allocator_type& __a)
       : __ostream_type(), _M_stringbuf(__mode | ios_base::out, __a)
@@ -895,7 +874,28 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 			    ios_base::openmode __mode = ios_base::out)
 	: basic_ostringstream(__str, __mode, allocator_type())
 	{ }
-#endif
+#endif // C++20
+
+      // 27.8.3.2 Assign and swap:
+
+      basic_ostringstream&
+      operator=(const basic_ostringstream&) = delete;
+
+      basic_ostringstream&
+      operator=(basic_ostringstream&& __rhs)
+      {
+	__ostream_type::operator=(std::move(__rhs));
+	_M_stringbuf = std::move(__rhs._M_stringbuf);
+	return *this;
+      }
+
+      void
+      swap(basic_ostringstream& __rhs)
+      {
+	__ostream_type::swap(__rhs);
+	_M_stringbuf.swap(__rhs._M_stringbuf);
+      }
+#endif // C++11
 
       // Members:
       /**
@@ -1061,27 +1061,6 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       _M_stringbuf(std::move(__rhs._M_stringbuf))
       { __iostream_type::set_rdbuf(&_M_stringbuf); }
 
-      // 27.8.3.2 Assign and swap:
-
-      basic_stringstream&
-      operator=(const basic_stringstream&) = delete;
-
-      basic_stringstream&
-      operator=(basic_stringstream&& __rhs)
-      {
-	__iostream_type::operator=(std::move(__rhs));
-	_M_stringbuf = std::move(__rhs._M_stringbuf);
-	return *this;
-      }
-
-      void
-      swap(basic_stringstream& __rhs)
-      {
-	__iostream_type::swap(__rhs);
-	_M_stringbuf.swap(__rhs._M_stringbuf);
-      }
-#endif
-
 #if __cplusplus > 201703L && _GLIBCXX_USE_CXX11_ABI
       basic_stringstream(ios_base::openmode __mode, const allocator_type& __a)
       : __iostream_type(), _M_stringbuf(__mode, __a)
@@ -1114,7 +1093,28 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
 						       | ios_base::out)
 	: basic_stringstream(__str, __mode, allocator_type())
 	{ }
-#endif
+#endif // C++20
+
+      // 27.8.3.2 Assign and swap:
+
+      basic_stringstream&
+      operator=(const basic_stringstream&) = delete;
+
+      basic_stringstream&
+      operator=(basic_stringstream&& __rhs)
+      {
+	__iostream_type::operator=(std::move(__rhs));
+	_M_stringbuf = std::move(__rhs._M_stringbuf);
+	return *this;
+      }
+
+      void
+      swap(basic_stringstream& __rhs)
+      {
+	__iostream_type::swap(__rhs);
+	_M_stringbuf.swap(__rhs._M_stringbuf);
+      }
+#endif // C++11
 
       // Members:
       /**


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-10 19:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 19:41 [gcc r11-4889] libstdc++: Reorder constructors in <sstream> Jonathan Wakely

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).