tmp/tmplh90cq6p/{from.md → to.md}
RENAMED
|
@@ -27,12 +27,12 @@ expression `views::drop(E, F)` is expression-equivalent to:
|
|
| 27 |
then
|
| 28 |
`U(ranges::begin(E) + std::min<D>(ranges::distance(E), F), ranges::end(E))`,
|
| 29 |
except that `E` is evaluated only once, where `U` is
|
| 30 |
`span<typename T::element_type>` if `T` is a specialization of `span`
|
| 31 |
and `T` otherwise.
|
| 32 |
-
- Otherwise, if `T` is a specialization of `subrange`
|
| 33 |
-
|
| 34 |
`T(ranges::begin(E) + std::min<D>(ranges::distance(E), F), ranges::{}end(E),
|
| 35 |
to-unsigned-like(ranges::distance(E) -
|
| 36 |
std::min<D>(ranges::distance(E), F)))`, except that `E` and `F` are
|
| 37 |
each evaluated only once.
|
| 38 |
- Otherwise, if `T` is a specialization of `repeat_view`
|
|
@@ -93,10 +93,20 @@ namespace std::ranges {
|
|
| 93 |
const auto s = ranges::size(base_);
|
| 94 |
const auto c = static_cast<decltype(s)>(count_);
|
| 95 |
return s < c ? 0 : s - c;
|
| 96 |
}
|
| 97 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
private:
|
| 99 |
V base_ = V(); // exposition only
|
| 100 |
range_difference_t<V> count_ = 0; // exposition only
|
| 101 |
};
|
| 102 |
|
|
|
|
| 27 |
then
|
| 28 |
`U(ranges::begin(E) + std::min<D>(ranges::distance(E), F), ranges::end(E))`,
|
| 29 |
except that `E` is evaluated only once, where `U` is
|
| 30 |
`span<typename T::element_type>` if `T` is a specialization of `span`
|
| 31 |
and `T` otherwise.
|
| 32 |
+
- Otherwise, if `T` is a specialization of `subrange` that models
|
| 33 |
+
`random_access_range` and `sized_range`, then
|
| 34 |
`T(ranges::begin(E) + std::min<D>(ranges::distance(E), F), ranges::{}end(E),
|
| 35 |
to-unsigned-like(ranges::distance(E) -
|
| 36 |
std::min<D>(ranges::distance(E), F)))`, except that `E` and `F` are
|
| 37 |
each evaluated only once.
|
| 38 |
- Otherwise, if `T` is a specialization of `repeat_view`
|
|
|
|
| 93 |
const auto s = ranges::size(base_);
|
| 94 |
const auto c = static_cast<decltype(s)>(count_);
|
| 95 |
return s < c ? 0 : s - c;
|
| 96 |
}
|
| 97 |
|
| 98 |
+
constexpr auto reserve_hint() requires approximately_sized_range<V> {
|
| 99 |
+
const auto s = static_cast<range_difference_t<V>>(ranges::reserve_hint(base_));
|
| 100 |
+
return to-unsigned-like(s < count_ ? 0 : s - count_);
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
constexpr auto reserve_hint() const requires approximately_sized_range<const V> {
|
| 104 |
+
const auto s = static_cast<range_difference_t<const V>>(ranges::reserve_hint(base_));
|
| 105 |
+
return to-unsigned-like(s < count_ ? 0 : s - count_);
|
| 106 |
+
}
|
| 107 |
+
|
| 108 |
private:
|
| 109 |
V base_ = V(); // exposition only
|
| 110 |
range_difference_t<V> count_ = 0; // exposition only
|
| 111 |
};
|
| 112 |
|