It took me a while to figure this out, but here is a potential solution to your problem:
module main; import std.stdio; int main(string[] argv) { bool test1PASS = func(1,2,3,4,5.5, true); //bool test2CTE = func(1,2,3,4,5, true, "CRAP"); bool test3PASS = func("CRAP", "3", "true"); //bool test4CTE = func("CRAP", "3", "true", 42, true, 6.5); return 0; } bool func(NOSTRINGS...)(NOSTRINGS x) if ({foreach(t; NOSTRINGS) if (is(t == string)) return false; return true; }()) { // code here ... return true; } bool func(ONLYSTRINGS...)(ONLYSTRINGS x) if ({foreach(t; ONLYSTRINGS) if (!is(t == string)) return false; return true; }()) { // code here ... return true; }
source share