Ali Çehreli:

If think it is a little too much to ask from the template system of D.

I remember hitting a similar problem with code like this bar() function:


// OK
void foo(size_t N1, size_t N2)(int[N1] a, int[N2] b)
if (N2 == N1 ^^ 2) {}

// Not OK
void bar(size_t N)(int[N] a, int[N ^ 2] b) {}

void main() {
    int[2] a = [1, 2];
    int[4] b = [1, 2, 3, 4];
    foo(a, b);
    bar(a, b);
}


So perhaps my suggestion to file an enhancement request is not a good idea...

Bye,
bearophile

Reply via email to