tmp/tmpv3uc5kzf/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `as_rvalue_view` <a id="range.as.rvalue.view">[[range.as.rvalue.view]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<view V>
|
| 6 |
+
requires input_range<V>
|
| 7 |
+
class as_rvalue_view : public view_interface<as_rvalue_view<V>> {
|
| 8 |
+
V base_ = V(); // exposition only
|
| 9 |
+
|
| 10 |
+
public:
|
| 11 |
+
as_rvalue_view() requires default_initializable<V> = default;
|
| 12 |
+
constexpr explicit as_rvalue_view(V base);
|
| 13 |
+
|
| 14 |
+
constexpr V base() const & requires copy_constructible<V> { return base_; }
|
| 15 |
+
constexpr V base() && { return std::move(base_); }
|
| 16 |
+
|
| 17 |
+
constexpr auto begin() requires (!simple-view<V>)
|
| 18 |
+
{ return move_iterator(ranges::begin(base_)); }
|
| 19 |
+
constexpr auto begin() const requires range<const V>
|
| 20 |
+
{ return move_iterator(ranges::begin(base_)); }
|
| 21 |
+
|
| 22 |
+
constexpr auto end() requires (!simple-view<V>) {
|
| 23 |
+
if constexpr (common_range<V>) {
|
| 24 |
+
return move_iterator(ranges::end(base_));
|
| 25 |
+
} else {
|
| 26 |
+
return move_sentinel(ranges::end(base_));
|
| 27 |
+
}
|
| 28 |
+
}
|
| 29 |
+
constexpr auto end() const requires range<const V> {
|
| 30 |
+
if constexpr (common_range<const V>) {
|
| 31 |
+
return move_iterator(ranges::end(base_));
|
| 32 |
+
} else {
|
| 33 |
+
return move_sentinel(ranges::end(base_));
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
constexpr auto size() requires sized_range<V> { return ranges::size(base_); }
|
| 38 |
+
constexpr auto size() const requires sized_range<const V> { return ranges::size(base_); }
|
| 39 |
+
};
|
| 40 |
+
|
| 41 |
+
template<class R>
|
| 42 |
+
as_rvalue_view(R&&) -> as_rvalue_view<views::all_t<R>>;
|
| 43 |
+
}
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
``` cpp
|
| 47 |
+
constexpr explicit as_rvalue_view(V base);
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
*Effects:* Initializes *base\_* with `std::move(base)`.
|
| 51 |
+
|