On Sunday, 1 May 2022 at 11:34:49 UTC, JG wrote:
On Sunday, 1 May 2022 at 07:59:57 UTC, Elfstone wrote:
On Sunday, 1 May 2022 at 06:42:26 UTC, Tejas wrote:
[...]

Thanks a lot! So this really is a D "feature".
The current behaviour is so broken. It makes no sense, for a language user at least. I don't understand why it's not yet solved, if it's a known issue.

I guess the current best is something like:

```d
enum isVector(V) = is(V==MatrixImpl!(S,1,N),S,size_t N);

@nogc
auto dot1(V)(in V lhs, in V rhs)
if(isVector!V) {
    return dot2(lhs,rhs);
}
```

or

```d
enum isVector(V) = is(V==MatrixImpl!(S,1,N),S,size_t N);

@nogc
auto dot1(V)(in V lhs, in V rhs)
if(isVector!V) {
static if(is(V==MatrixImpl!(S,1,N),S,N)) { S ret=0; return ret; }
    static assert("This should never been shown");
}
```

The static assert isn't needed.


```d
enum isVector(V) = is(V==MatrixImpl!(S,1,N),S,size_t N);

@nogc
auto dot1(V)(in V lhs, in V rhs)
if(isVector!V) {
static if(is(V==MatrixImpl!(S,1,N),S,N)) { S ret=0; return ret; }
}
```

Reply via email to