ReturnType and Parameters of Templated function/method
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Oct 13 14:07:17 PDT 2016
On Thursday, 13 October 2016 at 20:52:09 UTC, Patric Dexheimer
wrote:
> So for now my idea is to brute force the numbers of arguments
> with 'compiles' trait or trying to get the sourcecode somehow.
depending on source code form (even if you can get it) is highly
error-prone. consider it UB.
also, i think that you'd better not guess, but ask the user to
explicitly instantiate the methods with `alias` -- this way you
have to write less hacky code, and the user will have more
control over what is bound. you may provide helper mixin
templates to instantiate n-ary functions with given set of types
too. this is slightly more work on the user side, but it doesn't
depend on hacks and undocumented things.
More information about the Digitalmars-d-learn
mailing list