Static argument optimization

bearophile bearophileHUGS at lycos.com
Tue Oct 7 05:14:50 PDT 2008


dsimcha:
> It probably only works for D2, though.
> ...
> uint pow(alias n, alias power)() {
>     static if(__traits(compiles, test!(n)) && __traits(compiles, test!(power))) {
...

Are there ways in D1 to know if a given value is a compile time constant or a runtime variable?

Bye,
bearophile



More information about the Digitalmars-d mailing list