Debian Codegraph @

tests/dmd/runnable/imports/test11931d.d

raw
1 module imports.test11931d;
2
3 template filter(alias pred)
4 {
5 auto filter(Range)(Range r)
6 {
7 struct FilterResult
8 {
9 Range array()
10 {
11 return data;
12 }
13 Range data;
14 }
15 return FilterResult(r);
16 }
17 }
18
19 struct ConnectionPoint
20 {
21 void disconnect()
22 {
23 if(_f)
24 {
25 _f();
26 _f = null;
27 }
28 }
29 private void delegate() _f;
30 }
31
32 struct Signal(T, A...)
33 {
34 ConnectionPoint add(D f)
35 {
36 auto rf = { _arr = _arr.filter!(a => a != f).array; };
37 return ConnectionPoint();
38 }
39
40 private:
41 alias D = T delegate(A);
42 D[] _arr;
43 }