
On Fri, 01 Jul 2011 08:34:35 -0700, Eric Niebler wrote:
On 6/30/2011 11:09 PM, Paul Mensonides wrote:
...but this is terrible. It doesn't take away from the point of the talk, but it should be something like count<typelist<A, B, C>>, not count<A, B, C>.
I'm not disagreeing, but I'd like to know why you believe this is true for templates as well as macros.
I'd go further and say that it would be terrible to use variadic argument lists (the function parameter kind, not the template parameter kind) to as runtime data structures also. Off the top of my head, here are some reasons: 1) It forces a particular argument order. By itself, this isn't the end of the world, but either tends to break symmetries or tends to require argument orders to change on a bunch of other things. 2) It does not play well with overloading (via number of arguments with macros--which you can do, via specialization of templates, or via plain overloading of functions). 3) It frequently destroys the ability to use default arguments (which could be accounted for if it weren't for #2). 4) It does not work when multiple data structures need to be passed (e.g. Cartesian products). 5) It removes the ability to use the *single* variadic clump for other stuff. I don't have a problem with variadic data used to initialize regular data structures in the right contexts. For example, make_tuple(a, b, c). (I do believe, however, that std::initializer_list<T> is a misfeature. I personally think the { a, b, c } should have been mapped onto a constructor call taking a, b, and c--which may or may not use variadic templates). Regards, Paul Mensonides