On Tuesday, 17 August 2021 at 14:40:20 UTC, Ferhat Kurtulmuş wrote:
[snip]

Very informative, thanks. My code is lying here[1]. I want my struct to accept 2d static arrays, random access ranges, and "std.container.Array". I could achieve it with its present form, and I will probably slightly modify it based on your comments.

[1]: https://github.com/aferust/earcut-d/blob/master/source/earcutd.d#L34

If it would only accept dynamic arrays, you could use something like below

```d
import std.traits: isDynamicArray;

template DynamicArrayOf(T : U[], U)
    if (isDynamicArray!T)
{
    alias DynamicArrayOf = U;
}

struct Point {}

void main()
{
    static assert(is(DynamicArrayOf!(int[]) == int));
    static assert(is(DynamicArrayOf!(Point[]) == Point));
}
```

Reply via email to