Merge pull request from dkorpel/getd

com.getD: Remove redundant variant logic
This commit is contained in:
Adam D. Ruppe 2024-07-08 08:22:25 -04:00 committed by GitHub
commit 0c99dd2e30
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 14 deletions

15
com.d
View File

@ -250,20 +250,7 @@ struct ComResult {
}
T getD(T)() {
switch(result.vt) {
case VARENUM.VT_I4: // int
static if(is(T : const long))
return result.intVal;
throw new Exception("cannot convert variant of type int to requested " ~ T.stringof);
case VARENUM.VT_BSTR:
static if(is(T : const string))
return makeUtf8StringFromWindowsString(result.bstrVal); // FIXME free?
throw new Exception("cannot convert variant of type string to requested " ~ T.stringof);
default:
return getFromVariant!T(result);
//throw new Exception("can't handle this type " ~ to!string(result.vt));
}
return getFromVariant!T(result);
}
}