TypeFunction example creatiing a conversion matrix

Walter Bright newshound2 at digitalmars.com
Fri Oct 2 09:51:10 UTC 2020


On 10/1/2020 7:27 PM, Andrei Alexandrescu wrote:
> auto makeConvMatrix(Ts...)() {
>      bool[T.length[T.length] result;
>      static foreach (i, T : Ts)
>          static foreach (j, U : Ts)
>              result[i][j] = is(T : U);
>      return result;
> }

This piece of code may be useful in re-implementing std.meta.MostDerived.


More information about the Digitalmars-d mailing list