D alternative for C/C++ -Dfoo=42

Tobias Pankrath tobias at pankrath.net
Tue Feb 25 06:26:12 PST 2014


> Something like "static if(fileExists!"config.d") 
> mixin(import("config.d")) else ...".
>
> Thoughts?
>
> Regards
> - Cherry
--
static if(__traits(compiles, import("config.d")))
{
// import/parse/mixin
}
else
{
// default here
}
--

May be wrapped into a template for more convenience.


More information about the Digitalmars-d-learn mailing list