How to check for combinations of versions
Blatnik
blatblatnik at gmail.com
Wed May 5 17:34:19 UTC 2021
On Wednesday, 5 May 2021 at 15:25:31 UTC, Paul Backus wrote:
> However, if you really want something more expressive, and are
> confident in your ability to use the extra power responsibly,
> it is possible to work around these limitations:
>
> template hasVersion(string identifier) {
> mixin(
> "version(", identifier, ") enum hasVersion = true;",
> "else enum hasVersion = false;"
> );
> }
Hmm, I'll keep this in mind in case things start getting start
getting more out of hand. Thanks! :)
Mixin strings are still kind of like black magic to me, so I
prefer not to use them unless I really think they would help a
lot. In this case, I only do this 3 times in the entire codebase,
so it's not worth it yet.
And Dennis, sadly that wouldn't work for me since `version = XYZ`
only affects the current module and I'm using this check in
multiple modules.
Thanks for the help!
More information about the Digitalmars-d-learn
mailing list