]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/runnable/imports/ice15200b.d
d: Import dmd b8384668f, druntime e6caaab9, phobos 5ab9ad256 (v2.098.0-beta.1)
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / runnable / imports / ice15200b.d
1 module imports.ice15200b;
2
3 template filter(alias pred)
4 {
5 auto filter(R)(R range)
6 {
7 return FilterResult!(pred, R)(range);
8 }
9 }
10
11 struct FilterResult(alias pred, R)
12 {
13 R _input;
14
15 this(R r)
16 {
17 _input = r;
18 while (_input.length && !pred(_input[0]))
19 {
20 _input = _input[1..$];
21 }
22 }
23
24 @property bool empty()
25 {
26 return _input.length == 0;
27 }
28
29 @property auto ref front()
30 {
31 return _input[0];
32 }
33
34 void popFront()
35 {
36 do
37 {
38 _input = _input[1..$];
39 } while (_input.length && !pred(_input[0]));
40 }
41 }