| 1 |
// Verify the P2609R3 "Relaxing Ranges Just A Smidge" changes. |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
#include <iterator> |
| 5 |
#include <algorithm> |
| 6 |
#include <memory> |
| 7 |
#include <ranges> |
| 8 |
|
| 9 |
int |
| 10 |
main() |
| 11 |
{ |
| 12 |
auto v = std::views::iota(0, 5); |
| 13 |
auto proj = [](int v) { return std::make_unique<int>(v); }; |
| 14 |
using it = std::projected<std::ranges::iterator_t<decltype(v)>, decltype(proj)>; |
| 15 |
|
| 16 |
auto f = [](auto) { return false; }; |
| 17 |
static_assert(std::indirectly_unary_invocable<decltype(f), it>); |
| 18 |
static_assert(std::indirectly_regular_unary_invocable<decltype(f), it>); |
| 19 |
static_assert(std::indirect_unary_predicate<decltype(f), it>); |
| 20 |
|
| 21 |
auto g = [](auto, auto) { return false; }; |
| 22 |
static_assert(std::indirect_binary_predicate<decltype(g), it, it>); |
| 23 |
static_assert(std::indirect_equivalence_relation<decltype(g), it, it>); |
| 24 |
static_assert(std::indirect_strict_weak_order<decltype(g), it, it>); |
| 25 |
|
| 26 |
std::ranges::for_each(v, f, proj); |
| 27 |
} |