Ideally the decision would occur at compile time rather than runtime, to eliminate the dispatch overhead, so I think it would be likely to require macros, constexprs, or whatever compile-time execution mechanism is available in your language of choice