[Issue 19495] Lack of version conjunctions
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Mon Dec 17 15:54:13 UTC 2018
    
    
  
https://issues.dlang.org/show_bug.cgi?id=19495
anonymous4 <dfj1esp02 at sneakemail.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |spec
           Hardware|x86                         |All
                 OS|Mac OS X                    |All
--- Comment #1 from anonymous4 <dfj1esp02 at sneakemail.com> ---
Currently version statement is optimized for speed, you can have arbitrary
logic with static if.
---
template Defined(string s)
{
    mixin(`version(`~s~`)enum Defined=true;else enum Defined=false;`);
}
struct SVersion
{
    alias opDispatch(string s)=Defined!s;
}
enum Version=SVersion();
int main()
{
    static if(Version.OSX)writeln("running OSX");
    else writeln("no");
    return 0;
}
---
--
    
    
More information about the Digitalmars-d-bugs
mailing list