tmp/tmpl5egp1bu/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `as_const_view` <a id="range.as.const.view">[[range.as.const.view]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<view V>
|
| 6 |
+
requires input_range<V>
|
| 7 |
+
class as_const_view : public view_interface<as_const_view<V>> {
|
| 8 |
+
V base_ = V(); // exposition only
|
| 9 |
+
|
| 10 |
+
public:
|
| 11 |
+
as_const_view() requires default_initializable<V> = default;
|
| 12 |
+
constexpr explicit as_const_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>) { return ranges::cbegin(base_); }
|
| 18 |
+
constexpr auto begin() const requires range<const V> { return ranges::cbegin(base_); }
|
| 19 |
+
|
| 20 |
+
constexpr auto end() requires (!simple-view<V>) { return ranges::cend(base_); }
|
| 21 |
+
constexpr auto end() const requires range<const V> { return ranges::cend(base_); }
|
| 22 |
+
|
| 23 |
+
constexpr auto size() requires sized_range<V> { return ranges::size(base_); }
|
| 24 |
+
constexpr auto size() const requires sized_range<const V> { return ranges::size(base_); }
|
| 25 |
+
};
|
| 26 |
+
|
| 27 |
+
template<class R>
|
| 28 |
+
as_const_view(R&&) -> as_const_view<views::all_t<R>>;
|
| 29 |
+
}
|
| 30 |
+
```
|
| 31 |
+
|
| 32 |
+
``` cpp
|
| 33 |
+
constexpr explicit as_const_view(V base);
|
| 34 |
+
```
|
| 35 |
+
|
| 36 |
+
*Effects:* Initializes *base\_* with `std::move(base)`.
|
| 37 |
+
|