Skip to content

Commit

Permalink
Deploying to gh-pages from @ fa33b36 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
slymz committed Sep 8, 2023
1 parent 2927dd1 commit 26eb2c7
Show file tree
Hide file tree
Showing 4 changed files with 1,003 additions and 890 deletions.
66 changes: 53 additions & 13 deletions concat.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ toc: true

# Revision History

## R4
- Added additional constraint to `views::concat` to disable any combination of
range arguments that has a prvalue reference type, and another with a that of a
reference to that same type. Also added `views::concat_magic` to neglect this
additional constraint.

## R3

- Redesigned `iter_swap`
Expand Down Expand Up @@ -463,12 +469,13 @@ namespace std::ranges {
// [...]

// [range.concat], concat view
template <input_range... Views>
template <bool allow_magic, input_range... Views>
requires @*see below*@
class concat_view;

namespace views {
inline constexpr @_unspecified_@ concat = @_unspecified_@;
inline constexpr @_unspecified_@ concat_magic = @_unspecified_@;
}

}
Expand Down Expand Up @@ -524,13 +531,21 @@ Add the following subclause to [range.adaptors]{.sref}.
[1]{.pnum} `concat_view` presents a `view` that concatenates all the underlying
ranges.

[2]{.pnum} The name `views::concat` denotes a customization point object
[2]{.pnum} The names `views::concat` and `views::concat_magic` denote two customization point objects
([customization.point.object]{.sref}). Given a pack of subexpressions `Es...`,
the expression `views::concat(Es...)` is expression-equivalent to

- [2.1]{.pnum} `views::all(Es...)` if `Es` is a pack with only one element
and `views::all(Es...)` is a well formed expression,
- [2.2]{.pnum} otherwise, `concat_view(Es...)`
- [2.2]{.pnum} otherwise, `concat_view(Es...)`, which is deduced to be the type
`concat_view<false, views::all_t<Es>...>`.

And, the expression `views::concat_magic(Es...)` is expression-equivalent to

- [2.3]{.pnum} `views::all(Es...)` if `Es` is a pack with only one element
and `views::all(Es...)` is a well formed expression,
- [2.4]{.pnum} otherwise, `concat_view<true, views::all_t<Es...>>(Es...)`.


\[*Example:*
```cpp
Expand Down Expand Up @@ -561,6 +576,9 @@ namespace std::ranges {
concept @*concat-indirectly-readable*@ = @*see below*@; // exposition only

template <class... Rs>
concept @*concat-no-magic*@ = @*see below*@; // exposition only

template <bool allow_magic, class... Rs>
concept @_concatable_@ = @*see below*@; // exposition only

template <bool Const, class... Rs>
Expand All @@ -574,10 +592,10 @@ namespace std::ranges {
template <bool Const, class... Rs>
concept @_concat-is-bidirectional_@ = @*see below*@; // exposition only

template <input_range... Views>
template <bool allow_magic, input_range... Views>
requires (view<Views> && ...) && (sizeof...(Views) > 0) &&
@_concatable_@<Views...>
class concat_view : public view_interface<concat_view<Views...>> {
@_concatable_@<allow_magic, Views...>
class concat_view : public view_interface<concat_view<allow_magic, Views...>> {
tuple<Views...> @*views_*@; // exposition only

template <bool Const>
Expand All @@ -603,7 +621,7 @@ namespace std::ranges {
};

template <class... R>
concat_view(R&&...) -> concat_view<views::all_t<R>...>;
concat_view(R&&...) -> concat_view<false, views::all_t<R>...>;
}
```
Expand Down Expand Up @@ -640,8 +658,29 @@ concept @*concat-indirectly-readable*@ = // exposition only
:::
```cpp
template <class... Rs>
concept @*concat-no-magic*@ = @*see below*@; // exposition only
```

:::bq

[2]{.pnum} The exposition-only `@*concat-no-magic*@` concept is equivalent to:

```cpp
template <class... Rs>
concept @*concat-no-magic*@ = // exposition only
is_reference_v<@*concat-reference-t*@<Rs...>> ||
(is_reference_v<range_reference_t<Rs>> && ...) &&
(!same_as<remove_reference_t<range_reference_t<Rs>>,
@*concat-reference-t*@<Rs...>> && ...);
```
:::
```cpp
template <bool allow_magic, class... Rs>
concept @_concatable_@ = @*see below*@; // exposition only
```

Expand All @@ -651,12 +690,13 @@ concept @_concatable_@ = @*see below*@; // exposition only
concept is equivalent to:

```cpp
template <class... Rs>
template <bool allow_magic, class... Rs>
concept @_concatable_@ = requires { // exposition only
typename @*concat-reference-t*@<Rs...>;
typename @*concat-value-t*@<Rs...>;
typename @*concat-rvalue-reference-t*@<Rs...>;
} && @*concat-indirectly-readable*@<Rs...>;
} && @*concat-indirectly-readable*@<Rs...>
&& (allow_magic || @*concat-no-magic*@<Rs...>);
```
:::
Expand Down Expand Up @@ -709,7 +749,7 @@ constexpr explicit concat_view(Views... views);
```cpp
constexpr @_iterator_@<false> begin() requires(!(@_simple-view_@<Views> && ...));
constexpr @_iterator_@<true> begin() const
requires((range<const Views> && ...) && @_concatable_@<const Views...>);
requires((range<const Views> && ...) && @_concatable_@<allow_magic, const Views...>);
```
:::bq
Expand Down Expand Up @@ -774,11 +814,11 @@ return apply(
```cpp
namespace std::ranges{

template <input_range... Views>
template <bool allow_magic, input_range... Views>
requires (view<Views> && ...) && (sizeof...(Views) > 0) &&
@_concatable_@<Views...>
@_concatable_@<allow_magic, Views...>
template <bool Const>
class concat_view<Views...>::@_iterator_@ {
class concat_view<allow_magic, Views...>::@_iterator_@ {

public:
using iterator_category = @*see below*@; // not always present.
Expand Down
Loading

0 comments on commit 26eb2c7

Please sign in to comment.