// { dg-do compile { target c++20 } } // P2538R1 ADL-proof std::projected // https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2538r1.html #include template concept has_diff_type = requires { typename T::difference_type; }; static_assert( has_diff_type> ); struct Indy { using value_type = int; int operator*() const { return 0; } }; static_assert( ! std::weakly_incrementable ); static_assert( ! has_diff_type> ); // Examples from the paper: template struct Holder { T t; }; struct Incomplete; void test_concepts() { using T = Holder*; static_assert(std::equality_comparable); (void) std::indirectly_comparable>; (void) std::sortable; } #include void test_count() { Holder* a = nullptr; (void) std::count(&a, &a, nullptr); (void) std::ranges::count(&a, &a, nullptr); // { dg-bogus "." } }