On 02/03/20 10:03 +0100, Stephan Bergmann wrote:
On 21/02/2020 20:29, Patrick Palka wrote:
diff --git a/libstdc++-v3/include/bits/ranges_algo.h
b/libstdc++-v3/include/bits/ranges_algo.h
index 7de1072abf0..c36afc6e19b 100644
--- a/libstdc++-v3/include/bits/ranges_algo.h
+++ b/libstdc++-v3/include/bits/ranges_algo.h
@@ -3683,6 +3683,54 @@ namespace ranges
inline constexpr __prev_permutation_fn prev_permutation{};
} // namespace ranges
+
+ template<class ForwardIterator>
+ constexpr ForwardIterator
+ shift_left(ForwardIterator __first, ForwardIterator __last,
+ typename iterator_traits<ForwardIterator>::difference_type __n)
+ {
+ __glibcxx_assert(__n >= 0);
+ if (__n == 0)
+ return __last;
+
+ auto __mid = ranges::next(__first, __n, __last);
+ if (__mid == __last)
+ return __first;
+ return std::move(std::move(__mid), std::move(__last),
std::move(__first));
+ }
+
+ template<class ForwardIterator>
+ constexpr ForwardIterator
+ shift_right(ForwardIterator __first, ForwardIterator __last,
+ typename iterator_traits<ForwardIterator>::difference_type __n)
+ {
+ __glibcxx_assert(__n >= 0);
+ if (__n == 0)
+ return __first;
+
+ using _Cat = iterator_traits<ForwardIterator>::iterator_category;
^ FYI, the above line causes recent Clang 10 trunk with -std=c++20 to
fail due to a "missing" typedef
Thanks, fixed by this patch, committed to master now.
commit 5fad000324d0bcc87283dc339423bfad6fa42c74
Author: Jonathan Wakely <jwak...@redhat.com>
Date: Mon Mar 2 12:18:45 2020 +0000
libstdc++: Add 'typename' to fix compilation with Clang
* include/bits/ranges_algo.h (shift_right): Add 'typename' to
dependent type.
diff --git a/libstdc++-v3/include/bits/ranges_algo.h b/libstdc++-v3/include/bits/ranges_algo.h
index 8fa4a8a9161..a34f75f53d8 100644
--- a/libstdc++-v3/include/bits/ranges_algo.h
+++ b/libstdc++-v3/include/bits/ranges_algo.h
@@ -3710,7 +3710,7 @@ namespace ranges
if (__n == 0)
return __first;
- using _Cat = iterator_traits<ForwardIterator>::iterator_category;
+ using _Cat = typename iterator_traits<ForwardIterator>::iterator_category;
if constexpr (derived_from<_Cat, bidirectional_iterator_tag>)
{
auto __mid = ranges::next(__last, -__n, __first);