On Wednesday, 20 January 2016 at 21:44:06 UTC, David Nadlinger
wrote:
Can't you just write a wrapper function that takes the template
function as a compile-time argument and generates the switch
for you by iterating over the std.traits.EnumMembers of said
compile-time parameter?
Something like `enumTemplateDispatch!foo(detectBOM(buffer),
<runtime args>))`.
I have used EnumMembers a few times and it definitely saved me
the hassle of writing the switch myself.
However, in this case, isn't there a mapping between enums and
types that one still needs to specify? That is: ( UTF8=>char[],
UTF16=>wchar[], UTF32=>dchar[] ).