tmp/tmp2_zs9sbq/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#### Class template `zip_transform_view` <a id="range.zip.transform.view">[[range.zip.transform.view]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<move_constructible F, input_range... Views>
|
| 6 |
+
requires (view<Views> && ...) && (sizeof...(Views) > 0) && is_object_v<F> &&
|
| 7 |
+
regular_invocable<F&, range_reference_t<Views>...> &&
|
| 8 |
+
can-reference<invoke_result_t<F&, range_reference_t<Views>...>>
|
| 9 |
+
class zip_transform_view : public view_interface<zip_transform_view<F, Views...>> {
|
| 10 |
+
movable-box<F> fun_; // exposition only
|
| 11 |
+
zip_view<Views...> zip_; // exposition only
|
| 12 |
+
|
| 13 |
+
using InnerView = zip_view<Views...>; // exposition only
|
| 14 |
+
template<bool Const>
|
| 15 |
+
using ziperator = iterator_t<maybe-const<Const, InnerView>>; // exposition only
|
| 16 |
+
template<bool Const>
|
| 17 |
+
using zentinel = sentinel_t<maybe-const<Const, InnerView>>; // exposition only
|
| 18 |
+
|
| 19 |
+
// [range.zip.transform.iterator], class template zip_transform_view::iterator
|
| 20 |
+
template<bool> class iterator; // exposition only
|
| 21 |
+
|
| 22 |
+
// [range.zip.transform.sentinel], class template zip_transform_view::sentinel
|
| 23 |
+
template<bool> class sentinel; // exposition only
|
| 24 |
+
|
| 25 |
+
public:
|
| 26 |
+
zip_transform_view() = default;
|
| 27 |
+
|
| 28 |
+
constexpr explicit zip_transform_view(F fun, Views... views);
|
| 29 |
+
|
| 30 |
+
constexpr auto begin() { return iterator<false>(*this, zip_.begin()); }
|
| 31 |
+
|
| 32 |
+
constexpr auto begin() const
|
| 33 |
+
requires range<const InnerView> &&
|
| 34 |
+
regular_invocable<const F&, range_reference_t<const Views>...> {
|
| 35 |
+
return iterator<true>(*this, zip_.begin());
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
constexpr auto end() {
|
| 39 |
+
if constexpr (common_range<InnerView>) {
|
| 40 |
+
return iterator<false>(*this, zip_.end());
|
| 41 |
+
} else {
|
| 42 |
+
return sentinel<false>(zip_.end());
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
constexpr auto end() const
|
| 47 |
+
requires range<const InnerView> &&
|
| 48 |
+
regular_invocable<const F&, range_reference_t<const Views>...> {
|
| 49 |
+
if constexpr (common_range<const InnerView>) {
|
| 50 |
+
return iterator<true>(*this, zip_.end());
|
| 51 |
+
} else {
|
| 52 |
+
return sentinel<true>(zip_.end());
|
| 53 |
+
}
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
+
constexpr auto size() requires sized_range<InnerView> {
|
| 57 |
+
return zip_.size();
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
constexpr auto size() const requires sized_range<const InnerView> {
|
| 61 |
+
return zip_.size();
|
| 62 |
+
}
|
| 63 |
+
};
|
| 64 |
+
|
| 65 |
+
template<class F, class... Rs>
|
| 66 |
+
zip_transform_view(F, Rs&&...) -> zip_transform_view<F, views::all_t<Rs>...>;
|
| 67 |
+
}
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
``` cpp
|
| 71 |
+
constexpr explicit zip_transform_view(F fun, Views... views);
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
*Effects:* Initializes *fun\_* with `std::move(fun)` and *zip\_* with
|
| 75 |
+
`std::move(views)...`.
|
| 76 |
+
|