| Technical Specification | ||||
| Filesystem library(filesystem TS) | ||||
| Library fundamentals(library fundamentals TS) | ||||
| Library fundamentals 2(library fundamentals TS v2) | ||||
| Library fundamentals 3(library fundamentals TS v3) | ||||
| Extensions for parallelism(parallelism TS) | ||||
| Extensions for parallelism 2(parallelism TS v2) | ||||
| Extensions for concurrency(concurrency TS) | ||||
| Extensions for concurrency 2(concurrency TS v2) | ||||
| Concepts(concepts TS) | ||||
| Ranges(ranges TS) | ||||
| Reflection(reflection TS) | ||||
| Mathematical special functions(special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
| Iterator concepts | ||||||||||||
| Indirect callable concepts | ||||||||||||
| Common algorithm requirements | ||||||||||||
| Concept utilities | ||||||||||||
| Iterator utilities and operations | ||||||||||||
| ||||||||||||
| Iterator traits | ||||||||||||
| Iterator adaptors | ||||||||||||
| Stream iterators | ||||||||||||
Defined in header <experimental/ranges/iterator> | ||
namespace{ constexpr/* unspecified */ advance=/* unspecified */; | (ranges TS) (customization point object) | |
Call signature | ||
template< Iterator I> constexprvoid advance( I& i, ranges::difference_type_t<I> n); | (1) | |
template< Iterator I, Sentinel<I> S> constexprvoid 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 iteratorin times, or untilbound is reached, whichever comes first.
I modelsRandomAccessIterator, equivalent toi+= n. Otherwise, increments (or decrements ifn is negative)in times. The behavior is undefined ifn is negative andI does not modelBidirectionalIterator.[i, bound) does not denote a range, the behavior is undefined.[i, bound) shall denote a range; ifn==0, either[i, bound) or[bound, i) shall denote a range; ifn<0,[bound, i) shall denote a range,I andS shall be the same type, andI must modelBidirectionalIterator. Otherwise, the behavior is undefined.Contents |
The nameranges::advance denotes acustomization point object, which is afunction object of aliteralSemiregular class type (denoted, for exposition purposes, asAdvanceT). All instances ofAdvanceT are equal. Thus,ranges::advance can be copied freely and its copies can be used interchangeably.
Given a set of typesArgs..., ifstd::declval<Args>()... meet the requirements for arguments toranges::advance above,AdvanceT will satisfyranges::Invocable<const AdvanceT, Args...>. Otherwise, no function call operator ofAdvanceT participates in overload resolution.
In every translation unit in whichranges::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 theone-definition rule.)
M is the distance from the starting position ofi to the ending position and is negative if the ending position is before the starting position.| This section is incomplete Reason: no example |
| advances an iterator by given distance (function template)[edit] | |
| returns the distance between an iterator and a sentinel, or between the beginning and the end of a range (function template)[edit] | |
| increment an iterator (function template)[edit] | |
| decrement an iterator (function template)[edit] |