140
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
111
|
5 // @author@ =?iso-8859-1?q?Knud_S=F8rensen?= <knud@NetRunner.all-technology.com>
|
|
6 // @date@ 2004-05-30
|
140
|
7 // @uri@ news:pan.2004.05.30.19.54.44.280109@NetRunner.all-technology.com
|
1485
|
8 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=329
|
111
|
9
|
920
|
10 // __DSTRESS_ELINE__ 34
|
|
11
|
111
|
12 module dstress.nocompile.template_05;
|
|
13
|
|
14 template pow(x, int n){
|
|
15 static assert(n>=0);
|
|
16 enum {
|
|
17 pow = pow!(x,n % 2) * pow!(x*x,n/2)
|
|
18 }
|
|
19 }
|
|
20
|
|
21 template pow(x,int n:1) {
|
|
22 enum{
|
|
23 pow= x
|
|
24 }
|
|
25 }
|
|
26
|
|
27 template pow(x,int n:0) {
|
|
28 enum {
|
|
29 pow= 1
|
|
30 }
|
|
31 }
|
|
32
|
|
33 int main(){
|
|
34 pow!(3,4);
|
|
35 return 0;
|
|
36 }
|