1418
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
|
5 // @author@ Lionello Lunesu <lio@lunesu.remove.com>
|
|
6 // @date@ 2007-02-16
|
|
7 // @uri@ http://www.digitalmars.com/webnews/newsgroups.php?group=digitalmars.D&article_id=48917
|
|
8 // @desc@ Re: Compile time function execution...
|
|
9
|
|
10 module dstress.run.i.interpret_01_B;
|
|
11
|
|
12 template eval(A...) {
|
|
13 alias A eval;
|
|
14 }
|
|
15
|
|
16 char[] trimfirst(char[] s){
|
|
17 int x = 0;
|
|
18 foreach (char each; s) {
|
|
19 if (each != ' '){
|
|
20 return s[x .. $];
|
|
21 }
|
|
22 x++;
|
|
23 }
|
|
24 return s;
|
|
25 }
|
|
26
|
|
27 int main(){
|
|
28 char[] a = eval!(trimfirst(" test"))[0];
|
|
29 if(a != "test"){
|
|
30 assert(0);
|
|
31 }
|
|
32 return 0;
|
|
33 }
|