tmp/tmplzdxw9gb/{from.md → to.md}
RENAMED
|
@@ -5,19 +5,16 @@ namespace std::ranges {
|
|
| 5 |
template<view V>
|
| 6 |
requires (!common_range<V> && copyable<iterator_t<V>>)
|
| 7 |
class common_view : public view_interface<common_view<V>> {
|
| 8 |
private:
|
| 9 |
V base_ = V(); // exposition only
|
|
|
|
| 10 |
public:
|
| 11 |
-
common_view() = default;
|
| 12 |
|
| 13 |
constexpr explicit common_view(V r);
|
| 14 |
|
| 15 |
-
template<viewable_range R>
|
| 16 |
-
requires (!common_range<R> && constructible_from<V, views::all_t<R>>)
|
| 17 |
-
constexpr explicit common_view(R&& r);
|
| 18 |
-
|
| 19 |
constexpr V base() const & requires copy_constructible<V> { return base_; }
|
| 20 |
constexpr V base() && { return std::move(base_); }
|
| 21 |
|
| 22 |
constexpr auto begin() {
|
| 23 |
if constexpr (random_access_range<V> && sized_range<V>)
|
|
@@ -33,18 +30,18 @@ namespace std::ranges {
|
|
| 33 |
return common_iterator<iterator_t<const V>, sentinel_t<const V>>(ranges::begin(base_));
|
| 34 |
}
|
| 35 |
|
| 36 |
constexpr auto end() {
|
| 37 |
if constexpr (random_access_range<V> && sized_range<V>)
|
| 38 |
-
return ranges::begin(base_) + ranges::
|
| 39 |
else
|
| 40 |
return common_iterator<iterator_t<V>, sentinel_t<V>>(ranges::end(base_));
|
| 41 |
}
|
| 42 |
|
| 43 |
constexpr auto end() const requires range<const V> {
|
| 44 |
if constexpr (random_access_range<const V> && sized_range<const V>)
|
| 45 |
-
return ranges::begin(base_) + ranges::
|
| 46 |
else
|
| 47 |
return common_iterator<iterator_t<const V>, sentinel_t<const V>>(ranges::end(base_));
|
| 48 |
}
|
| 49 |
|
| 50 |
constexpr auto size() requires sized_range<V> {
|
|
@@ -64,13 +61,5 @@ namespace std::ranges {
|
|
| 64 |
constexpr explicit common_view(V base);
|
| 65 |
```
|
| 66 |
|
| 67 |
*Effects:* Initializes *base\_* with `std::move(base)`.
|
| 68 |
|
| 69 |
-
``` cpp
|
| 70 |
-
template<viewable_range R>
|
| 71 |
-
requires (!common_range<R> && constructible_from<V, views::all_t<R>>)
|
| 72 |
-
constexpr explicit common_view(R&& r);
|
| 73 |
-
```
|
| 74 |
-
|
| 75 |
-
*Effects:* Initializes *base\_* with `views::all(std::forward<R>(r))`.
|
| 76 |
-
|
|
|
|
| 5 |
template<view V>
|
| 6 |
requires (!common_range<V> && copyable<iterator_t<V>>)
|
| 7 |
class common_view : public view_interface<common_view<V>> {
|
| 8 |
private:
|
| 9 |
V base_ = V(); // exposition only
|
| 10 |
+
|
| 11 |
public:
|
| 12 |
+
common_view() requires default_initializable<V> = default;
|
| 13 |
|
| 14 |
constexpr explicit common_view(V r);
|
| 15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
constexpr V base() const & requires copy_constructible<V> { return base_; }
|
| 17 |
constexpr V base() && { return std::move(base_); }
|
| 18 |
|
| 19 |
constexpr auto begin() {
|
| 20 |
if constexpr (random_access_range<V> && sized_range<V>)
|
|
|
|
| 30 |
return common_iterator<iterator_t<const V>, sentinel_t<const V>>(ranges::begin(base_));
|
| 31 |
}
|
| 32 |
|
| 33 |
constexpr auto end() {
|
| 34 |
if constexpr (random_access_range<V> && sized_range<V>)
|
| 35 |
+
return ranges::begin(base_) + ranges::distance(base_);
|
| 36 |
else
|
| 37 |
return common_iterator<iterator_t<V>, sentinel_t<V>>(ranges::end(base_));
|
| 38 |
}
|
| 39 |
|
| 40 |
constexpr auto end() const requires range<const V> {
|
| 41 |
if constexpr (random_access_range<const V> && sized_range<const V>)
|
| 42 |
+
return ranges::begin(base_) + ranges::distance(base_);
|
| 43 |
else
|
| 44 |
return common_iterator<iterator_t<const V>, sentinel_t<const V>>(ranges::end(base_));
|
| 45 |
}
|
| 46 |
|
| 47 |
constexpr auto size() requires sized_range<V> {
|
|
|
|
| 61 |
constexpr explicit common_view(V base);
|
| 62 |
```
|
| 63 |
|
| 64 |
*Effects:* Initializes *base\_* with `std::move(base)`.
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|