Skip to content

Commit 4ed5a13

Browse files
burblebeetkoeppe
authored andcommitted
LWG3749 common_iterator should handle integer-class difference types
1 parent 2b36a7e commit 4ed5a13

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

source/iterators.tex

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5477,7 +5477,7 @@
54775477
template<@\libconcept{input_iterator}@ I, class S>
54785478
struct iterator_traits<common_iterator<I, S>> {
54795479
using iterator_concept = @\seebelow@;
5480-
using iterator_category = @\seebelow@;
5480+
using iterator_category = @\seebelow@; // not always present
54815481
using value_type = iter_value_t<I>;
54825482
using difference_type = iter_difference_t<I>;
54835483
using pointer = @\seebelow@;
@@ -5489,22 +5489,25 @@
54895489
\rSec3[common.iter.types]{Associated types}
54905490

54915491
\pnum
5492-
The nested \grammarterm{typedef-name}s of the specialization of
5493-
\tcode{iterator_traits} for \tcode{common_iterator<I, S>} are defined as follows.
5492+
The nested \grammarterm{typedef-name} \tcode{iterator_category} of
5493+
the specialization of \tcode{iterator_traits} for \tcode{common_iterator<I, S>}
5494+
is defined if and only if \tcode{iter_difference_t<I>} is an integral type.
5495+
In that case,
5496+
\tcode{iterator_category} denotes \tcode{forward_iterator_tag} if
5497+
the \grammarterm{qualified-id} \tcode{iterator_traits<I>::iterator_category}
5498+
is valid and denotes a type that
5499+
models \tcode{\libconcept{derived_from}<forward_iterator_tag>};
5500+
otherwise it denotes \tcode{input_iterator_tag}.
5501+
5502+
\pnum
5503+
The remaining nested \grammarterm{typedef-name}s of the specialization of
5504+
\tcode{iterator_traits} for \tcode{common_iterator<I, S>} are defined as follows:
54945505
\begin{itemize}
54955506
\item
54965507
\tcode{iterator_concept} denotes \tcode{forward_iterator_tag}
54975508
if \tcode{I} models \libconcept{forward_iterator};
54985509
otherwise it denotes \tcode{input_iterator_tag}.
54995510

5500-
\item
5501-
\tcode{iterator_category} denotes
5502-
\tcode{forward_iterator_tag}
5503-
if the \grammarterm{qualified-id} \tcode{iterator_traits<I>::iter\-ator_category}
5504-
is valid and denotes a type that
5505-
models \tcode{\libconcept{derived_from}<forward_iterator_tag>};
5506-
otherwise it denotes \tcode{input_iterator_tag}.
5507-
55085511
\item
55095512
Let \tcode{a} denote an lvalue of type \tcode{const common_iterator<I, S>}.
55105513
If the expression \tcode{a.operator->()} is well-formed,

0 commit comments

Comments
 (0)