public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Patrick Palka <ppalka@redhat.com>
To: gcc-patches@gcc.gnu.org
Cc: libstdc++@gcc.gnu.org,	jwakely@redhat.com,
	Patrick Palka <ppalka@redhat.com>
Subject: [PATCH 1/3] libstdc++: Apply the move_iterator changes described in P1207R4
Date: Tue, 04 Feb 2020 02:07:00 -0000	[thread overview]
Message-ID: <20200204020724.217468-1-ppalka@redhat.com> (raw)

These changes are needed for some of the tests in the constrained algorithm
patch, because they use move_iterator with an uncopyable output_iterator.  The
other changes described in the paper are already applied, it seems.

libstdc++-v3/ChangeLog:

	* include/bits/stl_iterator.h (move_iterator::move_iterator): Move the
	iterator when initializing _M_current.
	(move_iterator::base): Split into two overloads differing in
	ref-qualifiers as in P1207R4.
---
 libstdc++-v3/include/bits/stl_iterator.h | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h
index 784d200d22f..1a288a5c785 100644
--- a/libstdc++-v3/include/bits/stl_iterator.h
+++ b/libstdc++-v3/include/bits/stl_iterator.h
@@ -1166,7 +1166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
       explicit _GLIBCXX17_CONSTEXPR
       move_iterator(iterator_type __i)
-      : _M_current(__i) { }
+      : _M_current(std::move(__i)) { }
 
       template<typename _Iter>
 	_GLIBCXX17_CONSTEXPR
@@ -1174,9 +1174,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	: _M_current(__i.base()) { }
 
       _GLIBCXX17_CONSTEXPR iterator_type
-      base() const
+      base() const &
+#if __cplusplus > 201703L && __cpp_lib_concepts
+	requires copy_constructible<iterator_type>
+#endif
       { return _M_current; }
 
+      _GLIBCXX17_CONSTEXPR iterator_type
+      base() &&
+      { return std::move(_M_current); }
+
       _GLIBCXX17_CONSTEXPR reference
       operator*() const
       { return static_cast<reference>(*_M_current); }
-- 
2.25.0.114.g5b0ca878e0

             reply	other threads:[~2020-02-04  2:07 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-04  2:07 Patrick Palka [this message]
2020-02-04  2:08 ` [PATCH 3/3] libstdc++: Implement C++20 range adaptors Patrick Palka
2020-02-06 17:25   ` Jonathan Wakely
2020-02-06 23:53     ` Patrick Palka
2020-02-07 11:48       ` Jonathan Wakely
2020-02-07 14:28         ` Patrick Palka
2020-02-17 22:07   ` Stephan Bergmann
2020-02-18  1:20     ` Patrick Palka
2020-02-18  7:31       ` Stephan Bergmann
2020-02-18 11:56       ` Jonathan Wakely
2020-02-18 20:11         ` Stephan Bergmann
2020-02-18 23:41           ` Jonathan Wakely
2020-02-18 10:14     ` Jonathan Wakely
2020-02-04  2:09 ` [PATCH 2/3] libstdc++: Implement C++20 constrained algorithms Patrick Palka
2020-02-05 18:39   ` François Dumont
2020-02-05 19:25     ` Patrick Palka
2020-02-06 10:39       ` Jonathan Wakely
2020-02-06 12:36     ` Jonathan Wakely
2020-02-06 16:25   ` Jonathan Wakely
2020-02-07  1:13     ` Patrick Palka
2020-02-07 13:51   ` Jonathan Wakely
2020-02-13 18:07   ` François Dumont
2020-02-13 19:00     ` Jonathan Wakely
2020-02-14  6:00       ` François Dumont
2020-02-04 10:41 ` [PATCH 1/3] libstdc++: Apply the move_iterator changes described in P1207R4 Jonathan Wakely
2020-02-04 21:23   ` Patrick Palka
2020-02-04 21:49     ` Jonathan Wakely

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=20200204020724.217468-1-ppalka@redhat.com \
    --to=ppalka@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jwakely@redhat.com \
    --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).