std::experimental::ranges::advance
Defined in header <experimental/ranges/iterator>
|
||
namespace
{
constexpr /* unspecified */ advance = /* unspecified */; |
(ranges TS) (customization point object) |
|
Call signature |
||
template
< Iterator I >
constexpr void advance( I& i, ranges:: difference_type_t <I> n ) ; |
(1) | |
template
< Iterator I, Sentinel<I> S >
constexpr void advance( I& i, S bound ) ; |
(2) | |
template
< Iterator I, Sentinel<I> S >
constexpr ranges:: difference_type_t <I> advance( I& i, ranges:: difference_type_t <I> n, S bound ) ; |
(3) | |
Advances the iterator i n times, or until bound
I
models RandomAccessIterator
, equivalent to i += n. Otherwise, increments (or decrements if n is negative) i
n times. The behavior is undefined if n is negative and I
does not model BidirectionalIterator
[
i
,
bound
)
[
i
,
bound
)
shall denote a range; if n == 0, either [
i,
bound)
or
[
bound
,
i
)
shall denote a range; if n < 0,
[
bound
,
i
)
shall denote a range, I
and S
shall be the same type, and I
must model BidirectionalIterator
Customization point objects
The name ranges::advance
denotes a customization point object, which is a function object of a literal
Semiregular
class type (denoted, for exposition purposes, as AdvanceT
). All instances of AdvanceT
are equal. Thus, ranges::advance
Given a set of types Args...
, if
std::declval
<Args>
(
)
meet the requirements for arguments to ranges::advance
above, AdvanceT
will satisfy
ranges::Invocable<const AdvanceT, Args...>
. Otherwise, no function call operator of AdvanceT
In every translation unit in which ranges::advance
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
M
is the distance from the starting position of i
Example
This section is incomplete Reason: no example |
See also
advances an iterator by given distance (function template) |
|
returns the distance between an iterator and a sentinel, or between the beginning and the end of a range (function template) |
|
increment an iterator (function template) |
|
decrement an iterator (function template) |