1 module beard.type_set;
2 
3 public import beard.type_list;
4 public import beard.fold_left : foldLeft;
5 public import beard.contains  : contains;
6 
7 /// A typeset (contains no duplicate types).
8 template TSet(T...) {
9     mixin TL!T;
10 
11     template append(U) {
12         static if (contains!U)
13             alias TSet!T append;
14         else
15             alias TSet!(T, U) append;
16     }
17 
18     private template add(alias U, V) { alias U.append!V add; }
19 
20     template append(U...) if (U.length > 1) {
21         alias foldLeft!(add, TSet!T, U) append;
22     }
23 }
24 // vim:ts=4 sw=4