131
|
1 // { dg-do compile { target c++17 } }
|
|
2 // { dg-options "-fconcepts" }
|
111
|
3
|
|
4 #include <vector>
|
|
5
|
|
6 using namespace std;
|
|
7
|
|
8 template<typename T>
|
|
9 struct Sequence : std::false_type { };
|
|
10
|
|
11 template<typename T>
|
|
12 struct Predicate : std::false_type { };
|
|
13
|
|
14 template<typename Seq, typename Fn>
|
|
15 requires Sequence<Seq>{} and Predicate<Fn>{}
|
|
16 bool all(const Seq& seq, Fn fn) {
|
|
17 for(const auto& x : seq)
|
|
18 if (not fn(x))
|
|
19 return false;
|
|
20 return true;
|
|
21 }
|
|
22
|
|
23 int main() {
|
|
24 all(vector<int>{0, 2}, true); // { dg-error "not|bool" }
|
|
25 }
|