std::experimental::ranges::next (3) - Linux Manuals

std::experimental::ranges::next: std::experimental::ranges::next

NAME

std::experimental::ranges::next - std::experimental::ranges::next

Synopsis


Defined in header <experimental/ranges/iterator>
namespace { (ranges TS)
constexpr /* unspecified */ next = /* unspecified */; (customization point object)
}
Call signature
template< Iterator I > (1)
constexpr I next(I i);
template< Iterator I > (2)
constexpr I next(I i, ranges::difference_type_t<I> n);
template< Iterator I, Sentinel<I> S > (3)
constexpr I next(I i, S bound);
template< Iterator I, Sentinel<I> S > (4)
constexpr I next(I i, ranges::difference_type_t<I> n, S bound);


Advances the iterator i n times, or until bound is reached, whichever comes first, and returns the advanced iterator.
1) Equivalent to ++i; return i;.
2) Equivalent to ranges::advance(i, n); return i;.
3) Equivalent to ranges::advance(i, bound); return i;.
4) Equivalent to ranges::advance(i, n, bound); return i;.


Customization point objects


The name ranges::next denotes a customization point object, which is a function_object of a literal Semiregular class type (denoted, for exposition purposes, as NextT). All instances of NextT are equal. Thus, ranges::next can be copied freely and its copies can be used interchangeably.
Given a set of types Args..., if std::declval<Args>()... meet the requirements for arguments to ranges::next above, NextT will satisfy ranges::Invocable<const NextT, Args...>. Otherwise, no function call operator of NextT participates in overload resolution.
In every translation unit in which ranges::next is defined, it refers to the same instance of the customization point object. (This means that it can be used freely in things like inline functions and function templates without violating the one-definition_rule.)

Return value


The advanced iterator.

Notes


Even though omitting n for overload (2) behaves as if n is 1, omitting n for overload (4) effectively behaves as if n is infinity (always advance to bound).

Example


 This section is incomplete
 Reason: no example

See also


next increment an iterator
         (function template)
(C++11)
         advances an iterator by given distance
advance (function template)
         decrement an iterator
prev (function template)
         returns the distance between an iterator and a sentinel, or between the beginning and the end of a range
distance (function template)