What is the proper way to outline static-if-conditions ?
Elmar
chrehme at gmx.de
Sun Oct 10 15:39:32 UTC 2021
On Sunday, 10 October 2021 at 15:15:51 UTC, drug wrote:
>
> As I know it's impossible, but you can use a regular template:
> ```d
> template isPointedStaticArray(T)
> {
> static if (isPointer!T)
> enum isPointedStaticArray =
> isStaticArray!(PointerTarget!T);
> else
> enum isPointedStaticArray = false;
> }
> ```
> https://run.dlang.io/is/lR7feP
> this compiles from 2.086.1 and above
That's indeed close to pattern matching and is probably the best
answer :-) .
More information about the Digitalmars-d-learn
mailing list