[PATCH] libstdc++: P0769R2 Add shift to <algorithm>

Daniel Krügler daniel.kruegler@gmail.com
Mon Feb 24 14:16:00 GMT 2020


Am Mo., 24. Feb. 2020 um 15:12 Uhr schrieb Patrick Palka <ppalka@redhat.com>:
>
> On Mon, 24 Feb 2020, Jonathan Wakely wrote:
>
[...]
> > > @@ -3683,6 +3683,98 @@ 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 I'm reading the current draft correctly, n < 0 is allowed (and does
> > nothing) so we shouldn't assert here.
>
> From what I can tell, this is changed by P1243R4 (Rangify new
> algorithms) which adds the precondition n >= 0 to these routines.

Yes, that's correct. This part of the wording applied the accepted
changes of p1233r1.

- Daniel



More information about the Gcc-patches mailing list