const argument

TSalm TSalm at free.fr
Sat Mar 28 03:12:15 PDT 2009


Hello,

Is there a way to specifie a constant argument ( I would say an argument  
for which his value is evaluate at compile time )

For example, something like this :

/* -------- CODE --------- */
import tango.io.Stdout;

void func(const bool constArg)
{
     static if (constArg)
         Stdout("Yes").newline;
     else
         Stdout("No").newline;
}

void main()
{
     func( true );
     func( false );
}
/* -------- END CODE --------- */

Thanks in advance,
TSalm


More information about the Digitalmars-d-learn mailing list