tmp/tmp0r7qvt6_/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### All view <a id="range.all">[[range.all]]</a>
|
| 2 |
+
|
| 3 |
+
`views::all` returns a `view` that includes all elements of its `range`
|
| 4 |
+
argument.
|
| 5 |
+
|
| 6 |
+
The name `views::all` denotes a range adaptor object
|
| 7 |
+
[[range.adaptor.object]]. Given a subexpression `E`, the expression
|
| 8 |
+
`views::all(E)` is expression-equivalent to:
|
| 9 |
+
|
| 10 |
+
- `decay-copy(E)` if the decayed type of `E` models `view`.
|
| 11 |
+
- Otherwise, `ref_view{E}` if that expression is well-formed.
|
| 12 |
+
- Otherwise, `subrange{E}`.
|
| 13 |
+
|
| 14 |
+
#### Class template `ref_view` <a id="range.ref.view">[[range.ref.view]]</a>
|
| 15 |
+
|
| 16 |
+
`ref_view` is a `view` of the elements of some other `range`.
|
| 17 |
+
|
| 18 |
+
``` cpp
|
| 19 |
+
namespace std::ranges {
|
| 20 |
+
template<range R>
|
| 21 |
+
requires is_object_v<R>
|
| 22 |
+
class ref_view : public view_interface<ref_view<R>> {
|
| 23 |
+
private:
|
| 24 |
+
R* r_ = nullptr; // exposition only
|
| 25 |
+
public:
|
| 26 |
+
constexpr ref_view() noexcept = default;
|
| 27 |
+
|
| 28 |
+
template<not-same-as<ref_view> T>
|
| 29 |
+
requires see below
|
| 30 |
+
constexpr ref_view(T&& t);
|
| 31 |
+
|
| 32 |
+
constexpr R& base() const { return *r_; }
|
| 33 |
+
|
| 34 |
+
constexpr iterator_t<R> begin() const { return ranges::begin(*r_); }
|
| 35 |
+
constexpr sentinel_t<R> end() const { return ranges::end(*r_); }
|
| 36 |
+
|
| 37 |
+
constexpr bool empty() const
|
| 38 |
+
requires requires { ranges::empty(*r_); }
|
| 39 |
+
{ return ranges::empty(*r_); }
|
| 40 |
+
|
| 41 |
+
constexpr auto size() const requires sized_range<R>
|
| 42 |
+
{ return ranges::size(*r_); }
|
| 43 |
+
|
| 44 |
+
constexpr auto data() const requires contiguous_range<R>
|
| 45 |
+
{ return ranges::data(*r_); }
|
| 46 |
+
};
|
| 47 |
+
template<class R>
|
| 48 |
+
ref_view(R&) -> ref_view<R>;
|
| 49 |
+
}
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
``` cpp
|
| 53 |
+
template<not-same-as<ref_view> T>
|
| 54 |
+
requires see below
|
| 55 |
+
constexpr ref_view(T&& t);
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
*Remarks:* Let *`FUN`* denote the exposition-only functions
|
| 59 |
+
|
| 60 |
+
``` cpp
|
| 61 |
+
void FUN(R&);
|
| 62 |
+
void FUN(R&&) = delete;
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
The expression in the *requires-clause* is equivalent to
|
| 66 |
+
|
| 67 |
+
``` cpp
|
| 68 |
+
convertible_to<T, R&> && requires { FUN(declval<T>()); }
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
*Effects:* Initializes *r\_* with
|
| 72 |
+
`addressof(static_cast<R&>(std::forward<T>(t)))`.
|
| 73 |
+
|