diff options
author | Patrick Palka <ppalka@redhat.com> | 2020-01-22 16:51:19 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2020-02-04 22:19:47 -0500 |
commit | 7db12d155ddf4b5d7a5e783a97995f85e19e88dd (patch) | |
tree | 42e3d4a8ca8dc834f60e0cb5d7dd5685f8278cc5 | |
parent | 3ef39186b61939da7c658561b97f04b62973bf92 (diff) | |
download | gcc-7db12d155ddf4b5d7a5e783a97995f85e19e88dd.zip gcc-7db12d155ddf4b5d7a5e783a97995f85e19e88dd.tar.gz gcc-7db12d155ddf4b5d7a5e783a97995f85e19e88dd.tar.bz2 |
libstdc++: Apply the move_iterator changes described in P1207R4
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 __i
when initializing _M_current.
(move_iterator::base): Split into two overloads differing in
ref-qualifiers as in P1207R4 for C++20.
-rw-r--r-- | libstdc++-v3/ChangeLog | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_iterator.h | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index d925a0b..b54f1f6 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2020-02-05 Patrick Palka <ppalka@redhat.com> + + * include/bits/stl_iterator.h (move_iterator::move_iterator): Move __i + when initializing _M_current. + (move_iterator::base): Split into two overloads differing in + ref-qualifiers as in P1207R4 for C++20. + 2020-02-04 Jonathan Wakely <jwakely@redhat.com> * include/std/functional (_GLIBCXX_NOT_FN_CALL_OP): Un-define after diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index 784d200..c200f7a 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -1166,16 +1166,29 @@ _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 move_iterator(const move_iterator<_Iter>& __i) : _M_current(__i.base()) { } +#if __cplusplus <= 201703L _GLIBCXX17_CONSTEXPR iterator_type base() const { return _M_current; } +#else + constexpr iterator_type + base() const & +#if __cpp_lib_concepts + requires copy_constructible<iterator_type> +#endif + { return _M_current; } + + constexpr iterator_type + base() && + { return std::move(_M_current); } +#endif _GLIBCXX17_CONSTEXPR reference operator*() const |