1. 5
  1. 4

    Clever! I hate it, but clever!

    Google has—or used to have, I’m not sure—some string library functions like StrCat implemented with generated source code. Individual definitions for 1, 2, up to at least 20 args. And honestly, why not? It’s easy to understand. And any wacko using more than 20 actual parameters to a function has different problems.

    1. 2

      Yes, it’s cool you can do this, but I see this as a case of “Just because you can, doesn’t mean you should.”

      This technique optimizes the expressiveness of the call site at the expense of the one of the interface and implementation. Indeed, the interface needs naming and a comment to help clarify how to use it.

      It’s a very short list of people I know who have the template expertise to fix or update something like this. That expressiveness comes at the high price since it goes against how most programmers expect parameters lists in the language to extend to the right, such as with functions with default parameters and how parameter packs normally work.