Skip to content
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

[ranges] Different uses of "common range" #2590

Closed
JohelEGP opened this issue Dec 11, 2018 · 5 comments
Closed

[ranges] Different uses of "common range" #2590

JohelEGP opened this issue Dec 11, 2018 · 5 comments
Assignees

Comments

@JohelEGP
Copy link
Contributor

[range.req.general] defines (not in the sense of defining a term, like swapable) common range (which [common.iterator] uses, again, not as a term), and the subclause title for [range.refinements] uses it in another sense (and it even defines CommonRange!)

draft/source/iterators.tex

Lines 4551 to 4555 in a3ab84c

Class template \tcode{common_iterator} is an iterator/sentinel adaptor that is
capable of representing a non-common range of elements (where the types of the
iterator and sentinel differ) as a common range (where they are the same). It
does this by holding either an iterator or a sentinel, and implementing the
equality comparison operators appropriately.

draft/source/ranges.tex

Lines 669 to 671 in a3ab84c

Common ranges are ranges for which
\tcode{ranges::begin} and \tcode{ranges::end}
return objects of the same type.

\rSec2[range.refinements]{Common range refinements}

draft/source/ranges.tex

Lines 949 to 962 in a3ab84c

\pnum
The \tcode{CommonRange} concept specifies requirements of
a \libconcept{Range} type for which \tcode{ranges::begin} and
\tcode{ranges::end} return objects of the same type.
\begin{example}
The standard containers\iref{containers} model \tcode{CommonRange}.
\end{example}
\indexlibrary{\idxcode{CommonRange}}%
\begin{itemdecl}
template<class T>
concept CommonRange =
Range<T> && Same<iterator_t<T>, sentinel_t<T>>;
\end{itemdecl}

@JohelEGP
Copy link
Contributor Author

So there might be 2 problems here:

  • The lack of the definition of "common range", which CommonRange represents, and
  • the use of "common range" in the title for [range.refinements] with another meaning.

@JohelEGP
Copy link
Contributor Author

JohelEGP commented Dec 11, 2018

Just to be clear, by definition, models of ForwardRange also model CommonRange, but [range.refinements] also specifies OutputRange and InputRange, for which this many not be the case. It's use of "common" is the same as that of [alg.req].

draft/source/iterators.tex

Lines 2248 to 2255 in a3ab84c

\rSec2[alg.req]{Common algorithm requirements}
\rSec3[alg.req.general]{General}
\pnum
There are several additional iterator concepts that are commonly applied
to families of algorithms. These group together iterator requirements
of algorithm families.

@jensmaurer
Copy link
Member

jensmaurer commented Dec 19, 2018

I'm seeing the possible confusion potential in the phrasing of the heading "Common range refinements", but I'm not seeing the other issues. For once, CommonRange does not mention "common range" at all. Plus, the meaning of CommonRange seems to be the same as that intended for "common range", i.e. whether the iterator and the end marker are of the same type or of different types.
Alternative suggestion for the heading: "Other range refinements"
(The concepts that precede this subclause are also range refinements.)

@JohelEGP
Copy link
Contributor Author

If there's any other issue, it would be the use of "common range" without a centralized definition. All places it's used at define it.

@jensmaurer
Copy link
Member

Let's fix the heading.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants