Fix various template instantiation errors

Some templates broke because canDBus!(DictionaryEntry!(K,V)) now returns false.
Also, associative arrays are now handled without using a DictionaryEntry type. This is a first step in eliminating DictionaryEntry.
This commit is contained in:
Harry T. Vennik 2017-06-18 17:43:19 +02:00
parent a6aa85ac74
commit 3fa88ee9f7
2 changed files with 53 additions and 18 deletions

View file

@ -112,8 +112,6 @@ string typeSig(T)() if(canDBus!T) {
}
sig ~= ")";
return sig;
} else static if(is(T == DictionaryEntry!(K, V), K, V)) {
return '{' ~ typeSig!K ~ typeSig!V ~ '}';
} else static if(isInputRange!T) {
return "a" ~ typeSig!(ElementType!T)();
} else static if(isAssociativeArray!T) {
@ -121,6 +119,13 @@ string typeSig(T)() if(canDBus!T) {
}
}
string typeSig(T)() if(isInstanceOf!(DictionaryEntry, T)) {
static if(is(T == DictionaryEntry!(K, V), K, V)) // need to get K and V somehow
return "{" ~ typeSig!K ~ typeSig!V ~ '}';
else
static assert (false, "DictionaryEntry always has a key type and value type, right?");
}
string[] typeSigReturn(T)() if(canDBus!T) {
static if(is(T == Tuple!TS, TS...))
return typeSigArr!TS;
@ -149,6 +154,10 @@ int typeCode(T)() if(canDBus!T) {
return sig[0];
}
int typeCode(T)() if(isInstanceOf!(DictionaryEntry, T) && canDBus!(T[])) {
return 'e';
}
unittest {
import dunit.toolkit;
// basics