tmp/tmpc0ud6amz/{from.md → to.md}
RENAMED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
### Range adaptor helpers <a id="range.adaptor.helpers">[[range.adaptor.helpers]]</a>
|
| 2 |
+
|
| 3 |
+
``` cpp
|
| 4 |
+
namespace std::ranges {
|
| 5 |
+
template<class F, class Tuple>
|
| 6 |
+
constexpr auto tuple-transform(F&& f, Tuple&& t) { // exposition only
|
| 7 |
+
return apply([&]<class... Ts>(Ts&&... elements) {
|
| 8 |
+
return tuple<invoke_result_t<F&, Ts>...>(invoke(f, std::forward<Ts>(elements))...);
|
| 9 |
+
}, std::forward<Tuple>(t));
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
template<class F, class Tuple>
|
| 13 |
+
constexpr void tuple-for-each(F&& f, Tuple&& t) { // exposition only
|
| 14 |
+
apply([&]<class... Ts>(Ts&&... elements) {
|
| 15 |
+
(static_cast<void>(invoke(f, std::forward<Ts>(elements))), ...);
|
| 16 |
+
}, std::forward<Tuple>(t));
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
template<class T>
|
| 20 |
+
constexpr T& as-lvalue(T&& t) { // exposition only
|
| 21 |
+
return static_cast<T&>(t);
|
| 22 |
+
}
|
| 23 |
+
}
|
| 24 |
+
```
|
| 25 |
+
|