tmp/tmp_7gbywgk/{from.md → to.md}
RENAMED
|
@@ -46,10 +46,13 @@ namespace std::ranges {
|
|
| 46 |
}
|
| 47 |
}
|
| 48 |
|
| 49 |
constexpr auto size() requires sized_range<V>;
|
| 50 |
constexpr auto size() const requires sized_range<const V>;
|
|
|
|
|
|
|
|
|
|
| 51 |
};
|
| 52 |
}
|
| 53 |
```
|
| 54 |
|
| 55 |
``` cpp
|
|
@@ -71,5 +74,20 @@ using CT = common_type_t<ST, size_t>;
|
|
| 71 |
auto sz = static_cast<CT>(ranges::size(base_));
|
| 72 |
sz -= std::min<CT>(sz, N - 1);
|
| 73 |
return static_cast<ST>(sz);
|
| 74 |
```
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
}
|
| 47 |
}
|
| 48 |
|
| 49 |
constexpr auto size() requires sized_range<V>;
|
| 50 |
constexpr auto size() const requires sized_range<const V>;
|
| 51 |
+
|
| 52 |
+
constexpr auto reserve_hint() requires approximately_sized_range<V>;
|
| 53 |
+
constexpr auto reserve_hint() const requires approximately_sized_range<const V>;
|
| 54 |
};
|
| 55 |
}
|
| 56 |
```
|
| 57 |
|
| 58 |
``` cpp
|
|
|
|
| 74 |
auto sz = static_cast<CT>(ranges::size(base_));
|
| 75 |
sz -= std::min<CT>(sz, N - 1);
|
| 76 |
return static_cast<ST>(sz);
|
| 77 |
```
|
| 78 |
|
| 79 |
+
``` cpp
|
| 80 |
+
constexpr auto reserve_hint() requires approximately_sized_range<V>;
|
| 81 |
+
constexpr auto reserve_hint() const requires approximately_sized_range<const V>;
|
| 82 |
+
```
|
| 83 |
+
|
| 84 |
+
*Effects:* Equivalent to:
|
| 85 |
+
|
| 86 |
+
``` cpp
|
| 87 |
+
using DT = range_difference_t<decltype((base_))>;
|
| 88 |
+
using CT = common_type_t<DT, size_t>;
|
| 89 |
+
auto sz = static_cast<CT>(ranges::reserve_hint(base_));
|
| 90 |
+
sz -= std::min<CT>(sz, N - 1);
|
| 91 |
+
return to-unsigned-like(sz);
|
| 92 |
+
```
|
| 93 |
+
|