Conditional Compilation Multiple Versions

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 13 09:20:40 PDT 2015


On Sat, 13 Jun 2015 13:49:49 +0000, anonymous wrote:

> Taking it one step further:
> 
> template Version(string name)
> {
>      mixin("
>          version("~name~") enum Version = true;
>          else enum Version = false;
>      ");
> }
> 
> static if(Version!"One" || Version!"Two")
> {
>      ...
> }

very elegant.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150613/fe358af8/attachment.sig>


More information about the Digitalmars-d-learn mailing list