
On 2012-07-04 09:50, Eric Niebler wrote:
- original code: Eric's version - second attachment: my "boring" version Richard also offers an alternative (see ticket link above) which he claims to be much more effective, but I haven't comprehended it yet... Yes, I get it. He's using a variant of the variadic tuple trick. He wants to find the Nth element in a parameter pack. So he puts all the elements in a tuple-like thingy (select_impl) which holds individual elements, each in its own base class (select_base). But only the Nth base actually holds onto its argument. (See the partial specialization of select_base.) His solution instantiates O(N) instances of select_base, but gets you the Nth element in O(1). Fiendishly clever.
Huh! Thanks for the explanation! Really awesome! :-)