On 06/08/2018 11:13 AM, Brian wrote:
> Like:
>
> class A
> {
>      string b;
>      string c;
> }
>
> compile-time to:
>
> class A
> {
>      string _b;
>      string c;
> }
>
> or:
>
> class A
> {
>      string c;
> }
>

If these are your classes you can use static if or version:

version = Z;    // Can be provided as a compiler switch as well

class A
{
    version (X) {
        string b;

    } else version (Y) {
        string _b;
    }

     string c;
}

void main () {
}

Or with static if:

class A {
    static if (some_compile_time_condition) {
        string _b;

    } else static if (...) {
        // ...

    } else {
        // ...

    }
}

Ali

Reply via email to