On Thursday, 15 March 2018 at 14:13:25 UTC, jmh530 wrote:
On Thursday, 15 March 2018 at 12:49:22 UTC, jmh530 wrote:
[snip]
It looks like it should expand the alias earlier. No problem
with auto foo (T)(S!(1, T) v) {};
Also, this issue also shows up in mir.ndslice.traits. I had to
do the equivalent of isV below. It doesn't work to do the
alternate version. However, given that you have the traits,
then you can use them in a template constraint. So you have to
repeat yourself in the trait once, rather than bunches of times
in each function that calls them.
enum bool isV(T) = is(T : S!(1, U), U);
enum bool isV_alternate(T) = is(T : V!(U), U);
This does not help in practice because ndslice has an alias this
primitive to be implicitly convertible to const version.
For example for array one can write:
auto foo(T)(const(T)[] ar) {}
And this would work with double[] and immutable(double)[] as
well. The same true for ndslice:
auto foo(T)(Slice!(Contiguous, [1], const(T)*)[] ar) {}
It is very important to do not create additional institutions for
numeric code because usually it is quite heavy.
I don't know DMD internals. How the aliasing issue can be solved?
Best regards,
Ilya