On Tuesday, 18 February 2020 at 17:11:55 UTC, Marcel wrote:
Say I have a struct where every member function can either be static or not depending on a template parameter. Is there a simple way to do this?

The best I can think of is:

```
mixin template maybeStatic() {
    void foo() {
        // implementation
    }
}

struct S(bool condition) {
    static if (condition) {
        static {
            mixin maybeStatic;
        }
    } else {
        mixin maybeStatic;
    }
}
```

What do you need this for? It seems like an unusual situation to me.

Reply via email to