table of contents
        
      
      
    - Tumbleweed 2024.07.05-1.3
 - Leap-16.0
 
| std::ranges::subrange::next(3) | C++ Standard Libary | std::ranges::subrange::next(3) | 
NAME¶
std::ranges::subrange::next - std::ranges::subrange::next
Synopsis¶
 [[nodiscard]] constexpr subrange
    next(std::iter_difference_t<I> n
  
   = 1) const& (1) (since C++20)
  
   requires std::forward_iterator<I>;
  
   [[nodiscard]] constexpr subrange next(std::iter_difference_t<I> n
    (2) (since C++20)
  
   = 1) &&;
  
   1) Obtains a subrange whose iterator is incremented by min(n, size()) times
    or
  
   decremented by -n times respect to that of *this, when n >= 0 or n < 0
    respectively.
  
   Equivalent to auto tmp = *this; tmp.advance(n); return tmp;.
  
   2) Increments the stored iterator by min(n, size()) times or decremented it
    by -n
  
   times, when n >= 0 or n < 0 respectively, and then move-constructs the
    result from
  
   *this. Equivalent to advance(n); return std::move(*this);.
  
   The behavior is undefined if:
  
   * I does not model bidirectional_iterator and n < 0, or
  
   * the stored iterator is decremented after becoming a non-decrementable
    value.
Return value¶
 A subrange whose iterator is incremented by min(n, size()) times
    or decremented by
  
   -n times respect to the original value of that of *this, when n >= 0 or n
    < 0
  
   respectively.
Complexity¶
 Generally min(n, size()) increments or -n decrements on the
    iterator, when n >= 0 or
  
   n < 0 respectively.
  
   Constant if I models random_access_iterator, and either n < 0 or
  
   std::sized_sentinel_for<S, I> is modeled.
Notes¶
 A call to (2) may leave *this in a valid but unspecified
    state, depending on the
  
   behavior of the move constructor of I and S.
Example¶
 This section is incomplete
  
   Reason: no example
See also¶
 prev obtains a copy of the subrange with its iterator decremented
    by a given
  
   (C++20) distance
  
   (public member function)
  
   advance advances the iterator by given distance
  
   (C++20) (public member function)
  
   next increment an iterator
  
   (C++11) (function template)
  
   ranges::next increment an iterator by a given distance or to a bound
  
   (C++20) (niebloid)
Category:¶
* Todo no example
| 2024.06.10 | http://cppreference.com |