On Monday, 25 August 2014 at 11:41:28 UTC, bearophile wrote:
Oleg B:

[code]
void doSome(size_t N, T, string AS)( vec!(N,T,AS) v ) { }
struct vec(size_t N, T, string AS) { T[N] data; }
void main() { doSome( vec!(3,float,"xyz")([1,2,3]) ); }
[/code]

compile with new dmd v2.066.0 and get error:

Error: template opbin.doSome(ulong N, T, string AS)(vec!(N, T, AS) v) specialization not allowed for deduced parameter AS

what does it mean?

See also:


struct Vec(size_t N, T, alias string AS) {
    T[N] data;
}

void doSome(size_t N, T, alias string AS)(Vec!(N, T, AS) v) {}

void main() {
    auto v = Vec!(3, float, "xyz")([1, 2, 3]);
    doSome(v);
}


(Note that in D the names of types and structs start with an upper case).

Bye,
bearophile

Does it mean that I need write "alias" for all arrays in template parameters or only strings?

Reply via email to