compile-time function in a class?

Tyler Knott tywebmail at mailcity.com
Tue Mar 20 08:10:22 PDT 2007


You don't need to mark compile-time functions as static.  Functions are only evaluated at compile-time when they can't possibly be evaluated at run-time (such as in mixin declarations/statements/expressions or as initializers of static or global variables).  E.g.:

char[] exampleFunc() { return "example"; }

char[] example = exampleFunc(); //This is global, so exampleFunc is executed at compile-time

void func()
{
    char[] example = exampleFunc(); //Not global or static, so run-time
}



More information about the Digitalmars-d mailing list