Mercurial > projects > dstress
comparison run/mini/foreach9.d @ 1628:c6ef09dfba4d
add mini test set from ldc project
author | Moritz Warning <moritzwarning@web.de> |
---|---|
date | Mon, 10 Jan 2011 19:47:18 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1627:e1b954780837 | 1628:c6ef09dfba4d |
---|---|
1 module mini.foreach9; | |
2 extern(C) int printf(char* str, ...); | |
3 | |
4 struct array2d(T) { | |
5 int test() { | |
6 printf("%p\n", cast(void*) this); | |
7 foreach (x; *this) { | |
8 printf("%p\n", cast(void*) this); | |
9 } | |
10 return true; | |
11 } | |
12 int opApply(int delegate(ref int) dg) { | |
13 int x; | |
14 return dg(x), 0; | |
15 } | |
16 } | |
17 | |
18 unittest { | |
19 array2d!(int) test; | |
20 test.test(); | |
21 //int i = 0; i /= i; | |
22 } | |
23 | |
24 void main() { } |