From Generic Invocations to Generic Implementations
Software performance benefits from evaluating static information in expressions at compile time. Unlike most languages, C++ facilitates static computations by language means, instead of relying on separate preprocessing tools.
Programming techniques allow to express function invocations generically, providing the same call syntax for arguments of different static properties. However, the invoked implementations still differ syntactically, as they depend on those properties. A developer who wants to support alternative implementations of an algorithm is therefore forced to design and maintain these versions separately.
A common formulation is presented that allows one to implement an algorithm generically by a single definition, while encoding static parameter properties within the argument types. By the choice of argument representation, the user determines how the algorithm is evaluated. This decoupling preserves all information necessary to have the compiler create appropriate code for each case.
