1 module beard.contains;
2 
3 public import std.typetuple : staticIndexOf;
4 
5 /// Test if T... contains N.
6 template contains(N, T...) {
7     enum contains = staticIndexOf!(N, T) != -1;
8 }
9 
10 /// Test if C!T is defined for any T in T...
11 template containsMatch(alias C, T...) {
12     static if (! T.length)
13         enum containsMatch = false;
14     else static if (C!(T[0]))
15         enum containsMatch = true;
16     else
17         enum containsMatch = containsMatch!(C, T[1..$]);
18 }
19 // vim:ts=4 sw=4