How to specialize template function for associative arrays?

Aarti_pl aarti at interia.pl
Fri Oct 19 05:24:27 PDT 2007


Extrawurst pisze:
> as far as i know:
> 
> void parse(T : A[B])() {
> }
> 
> ~Extrawurst
> 
> 

Unfortunately not... I was also thinking that it will work, but you get 
compile time error instead:

quicktest.d(13): Error: identifier 'B' is not defined
quicktest.d(13): Error: index is not a type or an expression
quicktest.d(13): Error: identifier 'A' is not defined
quicktest.d(13): Error: A is used as a type

I managed to catch associative arrays with 'static if' and templates, 
but it would be better to use template specialization to have better 
source code structure.

Any other ideas?

BR
Marcin Kuszczak


More information about the Digitalmars-d-learn mailing list