Defining a version after it's tested for

Robert Clipsham robert at octarineparrot.com
Fri May 22 01:29:03 PDT 2009


Tim Matthews wrote:
> 
> I think this would be less ugly:
> 
> template vers(char[] V)
> {
>      mixin("version(" ~ V ~ ")
>      {
>            const bool vers = true;
>      }
>      else
>      {
>            const bool vers = false;
>      }");
> }
> 
> static if(vers!("BackendFoo") || vers!("Windows"))
> {
>       //
> }
> else static if(vers!("BackendBar"))
> {
>      //
> }
> else static if (vers!("BackendCar"))
> {
>     //
> }
> else
> {
>     //
> }
> 
> I would prefer the normal version statement to work like that directly 
> though.

This still doesn't solve my problem though, all it does is remove the 
usage of the version statement, which seems... pointless :S




More information about the Digitalmars-d mailing list