Skip to content

P2408R5 Ranges iterators as inputs to non-Ranges algorithms #5705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 17, 2022
Merged
Show file tree
Hide file tree
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
54 changes: 28 additions & 26 deletions source/algorithms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
Throughout this Clause, where the template parameters are not constrained,
the names of template parameters are used to express type requirements.
\begin{itemize}
\item
If an algorithm's \Fundescx{Effects} element specifies
that a value pointed to by any iterator passed as an argument is modified,
then the type of that argument shall meet
the requirements of a mutable iterator\iref{iterator.requirements}.
\item
If an algorithm's template parameter is named
\tcode{InputIterator},
Expand All @@ -86,16 +91,18 @@
\item
If an algorithm's template parameter is named
\tcode{ForwardIterator},
\tcode{ForwardIterator1}, or
\tcode{Forward\-Iterator2},
\tcode{ForwardIterator1},
\tcode{ForwardItera\-tor2}, or
\tcode{NoThrowForwardIterator},
the template argument shall meet the
\oldconcept{ForwardIterator} requirements\iref{forward.iterators}.
\oldconcept{ForwardIterator} requirements\iref{forward.iterators}
if it is required to be a mutable iterator, or
model \libconcept{forward_iterator}\iref{iterator.concept.forward} otherwise.
\item
If an algorithm's template parameter is named
\tcode{NoThrowForwardIterator},
the template argument shall meet the
\oldconcept{ForwardIterator} requirements\iref{forward.iterators}, and
is required to have the property that no exceptions are thrown
the template argument
is also required to have the property that no exceptions are thrown
from increment, assignment, or comparison of, or
indirection through, valid iterators.
\item
Expand All @@ -104,28 +111,23 @@
\tcode{Bidirectional\-Iterator1}, or
\tcode{BidirectionalIterator2},
the template argument shall meet the
\oldconcept{BidirectionalIterator} requirements\iref{bidirectional.iterators}.
\oldconcept{BidirectionalIterator} requirements\iref{bidirectional.iterators}
if it is required to be a mutable iterator, or model
\libconcept{bidirectional_iterator}\iref{iterator.concept.bidir} otherwise.
\item
If an algorithm's template parameter is named
\tcode{RandomAccessIterator},
\tcode{Random\-AccessIterator1}, or
\tcode{RandomAccessIterator2},
the template argument shall meet the
\oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}.
\oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}
if it is required to be a mutable iterator, or model
\libconcept{random_access_iterator}\iref{iterator.concept.random.access} otherwise.
\end{itemize}

\pnum
If an algorithm's \effects element specifies
that a value pointed to by any iterator passed as an argument is modified,
then that algorithm has an additional type requirement:
The type of that argument shall meet
the requirements of a mutable iterator\iref{iterator.requirements}.
\begin{note}
This requirement does not affect arguments that are named
\tcode{OutputIterator}, \tcode{OutputIterator1}, or \tcode{OutputIterator2},
because output iterators must always be mutable, nor
does it affect arguments that are constrained,
for which mutability requirements are expressed explicitly.
These requirements do not affect iterator arguments that are constrained,
for which iterator category and mutability requirements
are expressed explicitly.
\end{note}

\pnum
Expand Down Expand Up @@ -6033,8 +6035,8 @@
\item
For the overloads with no \tcode{ExecutionPolicy},
let \tcode{T} be the value type of \tcode{InputIterator}.
If \tcode{InputIterator} meets
the \oldconcept{ForwardIterator} requirements,
If \tcode{InputIterator} models
\libconcept{forward_iterator}\iref{iterator.concept.forward},
then there are no additional requirements for \tcode{T}.
Otherwise, if \tcode{OutputIterator} meets
the \oldconcept{ForwardIterator} requirements and
Expand Down Expand Up @@ -6339,8 +6341,8 @@
\item
\tcode{SampleIterator} meets
the \oldconcept{RandomAccessIterator} requirements\iref{random.access.iterators}
unless \tcode{Pop\-ulat\-ion\-Iter\-ator} meets
the \oldconcept{ForwardIterator} requirements\iref{forward.iterators}.
unless \tcode{Pop\-ulat\-ion\-Iter\-ator}
models \libconcept{forward_iterator}\iref{iterator.concept.forward}.
\item
\tcode{remove_reference_t<UniformRandomBitGenerator>} meets
the requirements of a uniform random bit generator type\iref{rand.req.urng}.
Expand Down Expand Up @@ -6369,8 +6371,8 @@
\begin{itemize}
\item
For the overload in namespace \tcode{std},
stable if and only if \tcode{PopulationIterator} meets
the \oldconcept{For\-wardIterator} requirements.
stable if and only if \tcode{PopulationIterator}
models \libconcept{forward_iterator}.
For the first overload in namespace \tcode{ranges},
stable if and only if \tcode{I} models \libconcept{forward_iterator}.
\item
Expand Down
8 changes: 4 additions & 4 deletions source/regex.tex
Original file line number Diff line number Diff line change
Expand Up @@ -2691,8 +2691,8 @@
\begin{itemdescr}
\pnum
\expects
\tcode{BidirectionalIterator} meets the
\oldconcept{BidirectionalIterator} requirements\iref{bidirectional.iterators}.
\tcode{BidirectionalIterator} models
\libconcept{bidirectional_iterator}\iref{iterator.concept.bidir}.

\pnum
\effects
Expand Down Expand Up @@ -2881,8 +2881,8 @@
\begin{itemdescr}
\pnum
\expects
\tcode{BidirectionalIterator} meets the
\oldconcept{BidirectionalIterator} requirements\iref{bidirectional.iterators}.
\tcode{BidirectionalIterator} models
\libconcept{bidirectional_iterator}\iref{iterator.concept.bidir}.

\pnum
\effects
Expand Down
2 changes: 2 additions & 0 deletions source/support.tex
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,8 @@
\begin{codeblock}
// all freestanding
#define @\defnlibxname{cpp_lib_addressof_constexpr}@ 201603L // also in \libheader{memory}
#define @\defnlibxname{cpp_lib_algorithm_iterator_requirements}@ 202207L
// also in \libheader{algorithm}, \libheader{numeric}, \libheader{memory}
#define @\defnlibxname{cpp_lib_allocate_at_least}@ 202106L // also in \libheader{memory}
#define @\defnlibxname{cpp_lib_allocator_traits_is_always_equal}@ 201411L
// also in \libheader{memory}, \libheader{scoped_allocator}, \libheader{string}, \libheader{deque}, \libheader{forward_list}, \libheader{list}, \libheader{vector},
Expand Down