Is there any way to check for multiple conditions in a version
statement?
For example, my platform may have Version_A
and Version_B
, and both versions provide some shiny feature I want to use. Is there some nice way to write:
version (Version_A || Version_B) {
// Use the cool feature.
} else {
// Do something less cool but portable.
}
Currently I resort to something like this, but I'm curious if there's a nicer way to do it.
version (Version_A) {
enum Cool_Feature_Supported = true;
} else version (Version_B) {
enum Cool_Feature_Supported = true;
} else {
enum Cool_Feature_Supported = false;
}
...
void do_something_cool() {
static if (Cool_Feature_Supported) {
...
} else {
...
}
}