Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
std::ranges...brange::next(3) C++ Standard Libarystd::ranges...brange::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	decre-
       mented 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-decre-
       mentable	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	itera-
       tor, 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, de-
       pending 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	decre-
       mented 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

http://cppreference.com		  2024.06.10	 std::ranges...brange::next(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=std::ranges::subrange::next&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help