Skip to content

Commit

Permalink
renamed concat-random-access and concat-bidirectional to concat-is-ra…
Browse files Browse the repository at this point in the history
…ndom-access and concat-is-bidirectional, respectively
  • Loading branch information
slymz committed Jun 7, 2023
1 parent 9cc111c commit 9fd6171
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
2 changes: 2 additions & 0 deletions concat.lwg.feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
synopsis) after zip and cartesian_product was in. Wants to make sure we
don't define it again. (But we don't. So...)
- Hui: Maybe they meant that we should add `Const` as template parameter for concepts like `concat-random-access` and `concat-bidirectional`, like what they did for `all-random-access` etc. So that we don't repeat the `maybe_const` in the every usage of `concat-random-access`? What do you think?
- Levent: Sounds right! Also the naming can be more consistent with https://eel.is/c++draft/range.cartesian#view,
`concat-is-random-access` instead of `concat-random-access` etc.

- [TODO] do we want to avoid emplacing ranges we don't need to use?
- Hui: Good point. I think this refers to `advance_fwd` and `advance_bwd`. Maybe we can do something smarter.
Expand Down
60 changes: 30 additions & 30 deletions concat.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ namespace std::ranges {
concept @_concatable_@ = @*see below*@; // exposition only

template <class... Rs>
concept @_concat-random-access_@ = // exposition only
concept @_concat-is-random-access_@ = // exposition only
((random_access_range<Rs> && sized_range<Rs>)&&...);

template <class R>
Expand All @@ -486,7 +486,7 @@ namespace std::ranges {
(sized_range<R> && random_access_range<R>);

template <class... Rs>
concept @_concat-bidirectional_@ = @*see below*@; // exposition only
concept @_concat-is-bidirectional_@ = @*see below*@; // exposition only

template <input_range... Views>
requires (view<Views> && ...) && (sizeof...(Views) > 0) &&
Expand Down Expand Up @@ -577,12 +577,12 @@ concept @_concatable_@ = requires { // exposition only
```cpp
template <class... Rs>
concept @_concat-bidirectional_@ = @*see below*@; // exposition only
concept @_concat-is-bidirectional_@ = @*see below*@; // exposition only
```

:::bq

[3]{.pnum} `@_concat-bidirectional_@` is modeled by `Rs...`, if and only if,
[3]{.pnum} `@_concat-is-bidirectional_@` is modeled by `Rs...`, if and only if,

- [3.1]{.pnum} The last element of `Rs...` models `bidirectional_range`,
- [3.2]{.pnum} And, all except the last element of `Rs...` model `@_constant-time-reversible_@`.
Expand Down Expand Up @@ -719,19 +719,19 @@ namespace std::ranges{
requires @*all-forward*@<Const, Views...>;

constexpr @_iterator_@& operator--()
requires @_concat-bidirectional_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-bidirectional_@<@_maybe-const_@<Const, Views>...>;

constexpr @_iterator_@ operator--(int)
requires @_concat-bidirectional_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-bidirectional_@<@_maybe-const_@<Const, Views>...>;

constexpr @_iterator_@& operator+=(difference_type n)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

constexpr @_iterator_@& operator-=(difference_type n)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

constexpr decltype(auto) operator[](difference_type n) const
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

friend constexpr bool operator==(const @_iterator_@& x, const @_iterator_@& y)
requires(equality_comparable<iterator_t<@_maybe-const_@<Const, Views>>>&&...);
Expand All @@ -755,22 +755,22 @@ namespace std::ranges{
(three_way_comparable<@_maybe-const_@<Const, Views>> &&...));

friend constexpr @_iterator_@ operator+(const @_iterator_@& it, difference_type n)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

friend constexpr @_iterator_@ operator+(difference_type n, const @_iterator_@& it)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

friend constexpr @_iterator_@ operator-(const @_iterator_@& it, difference_type n)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

friend constexpr difference_type operator-(const @_iterator_@& x, const @_iterator_@& y)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

friend constexpr difference_type operator-(const @_iterator_@& x, default_sentinel_t)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

friend constexpr difference_type operator-(default_sentinel_t, const @_iterator_@& x)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;

friend constexpr decltype(auto) iter_move(const iterator& it) noexcept(@*see below*@);

Expand All @@ -783,10 +783,10 @@ namespace std::ranges{
[1]{.pnum} `@_iterator_@::iterator_concept` is defined as follows:
- [1.1]{.pnum} If `@_concat-random-access_@<@_maybe-const_@<Const, Views>...>`
- [1.1]{.pnum} If `@_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>`
is modeled, then `iterator_concept` denotes `random_access_iterator_tag`.
- [1.2]{.pnum} Otherwise, if
`@_concat-bidirectional_@<@_maybe-const_@<Const, Views>...>` is modeled, then
`@_concat-is-bidirectional_@<@_maybe-const_@<Const, Views>...>` is modeled, then
`iterator_concept` denotes `bidirectional_iterator_tag`.
- [1.3]{.pnum} Otherwise, if `@*all-forward*@<Const, Views...>` is modeled, then
`iterator_concept` denotes `forward_iterator_tag`.
Expand All @@ -801,10 +801,10 @@ namespace std::ranges{
- [2.2]{.pnum} Otherwise, let `Cs` denote the pack of types
`iterator_traits<iterator_t<@*maybe-const*@<Const, Views>>>::iterator_category...`.
- [2.2.1]{.pnum} If
`(derived_from<Cs, random_access_iterator_tag> && ...) && @_concat-random-access_@<@_maybe-const_@<Const, Views>...>`
`(derived_from<Cs, random_access_iterator_tag> && ...) && @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>`
is true, `iterator_category` denotes `random_access_iterator_tag`.
- [2.2.2]{.pnum} Otherwise, if
`(derived_from<Cs, bidirectional_iterator_tag> && ...) && @_concat-bidirectional_@<@_maybe-const_@<Const, Views>...>`
`(derived_from<Cs, bidirectional_iterator_tag> && ...) && @_concat-is-bidirectional_@<@_maybe-const_@<Const, Views>...>`
is true, `iterator_category` denotes `bidirectional_iterator_tag`.
- [2.2.3]{.pnum} Otherwise, If `(derived_from<Cs, forward_iterator_tag> && ...)` is true, `iterator_category` denotes `forward_iterator_tag`.
- [2.2.4]{.pnum} Otherwise, `iterator_category` denotes `input_iterator_tag`.
Expand Down Expand Up @@ -1011,7 +1011,7 @@ return tmp;

```cpp
constexpr @_iterator_@& operator--()
requires @_concat-bidirectional_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-bidirectional_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand All @@ -1029,7 +1029,7 @@ return *this;

```cpp
constexpr @_iterator_@ operator--(int)
requires @_concat-bidirectional_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-bidirectional_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand All @@ -1046,7 +1046,7 @@ return tmp;

```cpp
constexpr @_iterator_@& operator+=(difference_type n)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand All @@ -1068,7 +1068,7 @@ return *this;

```cpp
constexpr @_iterator_@& operator-=(difference_type n)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand All @@ -1086,7 +1086,7 @@ return *this;

```cpp
constexpr decltype(auto) operator[](difference_type n) const
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```
:::bq
Expand Down Expand Up @@ -1168,7 +1168,7 @@ return x.@*it_*@ @*op*@ y.@*it_*@;

```cpp
friend constexpr @_iterator_@ operator+(const @_iterator_@& it, difference_type n)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand All @@ -1185,7 +1185,7 @@ return @_iterator_@{it} += n;
```cpp
friend constexpr @_iterator_@ operator+(difference_type n, const @_iterator_@& it)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand All @@ -1202,7 +1202,7 @@ return it + n;

```cpp
friend constexpr @_iterator_@ operator-(const @_iterator_@& it, difference_type n)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand All @@ -1219,7 +1219,7 @@ return @*iterator*@{it} -= n;
```cpp
friend constexpr difference_type operator-(const @_iterator_@& x, const @_iterator_@& y)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand Down Expand Up @@ -1259,7 +1259,7 @@ denote `y.@*it_*@.index()`

```cpp
friend constexpr difference_type operator-(const @_iterator_@& x, default_sentinel_t)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand All @@ -1281,7 +1281,7 @@ return -(static_cast<difference_type>(@*d~x~*@) + static_cast<difference_type>(s

```cpp
friend constexpr difference_type operator-(default_sentinel_t, const @_iterator_@& x)
requires @_concat-random-access_@<@_maybe-const_@<Const, Views>...>;
requires @_concat-is-random-access_@<@_maybe-const_@<Const, Views>...>;
```

:::bq
Expand Down

0 comments on commit 9fd6171

Please sign in to comment.