Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions source/iterators.tex
Original file line number Diff line number Diff line change
Expand Up @@ -692,6 +692,24 @@
The result of the application of library functions
to invalid ranges is undefined.

\pnum
For an iterator \tcode{i} of a type that
models \libconcept{contiguous_iterator}\iref{iterator.concept.contiguous},
library functions are permitted
to replace \range{i}{s} with
\range{to_address(i)}{to_address(i + ranges::distance(i, s))}, and
to replace \countedrange{i}{n} with \range{to_address(i)}{to_address(i + n)}.
\begin{note}
This means a program cannot rely on any side effects of
dereferencing a contiguous iterator \tcode{i},
because library functions might operate on
pointers obtained by \tcode{to_address(i)}
instead of operating on \tcode{i}.
Similarly, a program cannot rely on any side effects of
individual increments on a contiguous iterator \tcode{i},
because library functions might advance \tcode{i} only once.
\end{note}

\pnum
All the categories of iterators require only those functions that are realizable for a given category in
constant time (amortized).
Expand Down