Variadic Templates are Funadic

Description

Variadic templates are arguably the most profound change in the core language brought about by C++11. Curiously, however, the C++ community still tiptoes carefully around them: variadic templates enjoyed less coverage than features such as "auto" or lambdas. Part of the reason is that more popular features simplify expression of existing designs, which makes said features easier to understand and use.

Variadic templates, however, not only simplify design and use of advanced libraries such as Boost MPL, but also enable a host of new uses.

This talk provides a solid coverage of variadic fundamentals, including typelists, the archetypal "safe printf" mechanics, and tuple construction and access. It also discusses more advanced uses, such as structured argument lists.

The Discussion

I believe they said that preparing the videos of the talks takes about a day, so I would expect to see any not yet uploaded talks at the beginning of next week. It was a great talk, no Chutuloid-template-horror as one Twitter user was fearing :)

Update: It's still encoding (step 5 of 6)... Then, there will be the time it takes to copy all the files to the C9 cloud (this is more a physics problem that can't be solved using template metaprogramming). Fear not. You'll get to see and hear from Andrei soon! In the meantime, I encourage you to eat plenty of blueberries and some fatty fish (omega 3/5 rich) to encourage and accelerate the growth of brain cells. You'll need plenty of them to get the most out of this talk. That's a good thing

Either a missing "class Name" or the "template< >" around the policies is too much. So much for "My code has no mistakes".

Other than that, great talk. Enjoyed it very much. Though one thing I'd certainly like to see from the standard side is better (read: smarter) pack expansion, so we don't need to resort to recursion all that often if the expansion is actually really trivial (say, + instead of a comma):

The table on the slide is devided by an (invisible) vertical bar between the "Use" and "Expansion" column, namely (in this line) between "func(5, vs)..." and "func(5,v1), ..., func(5, vn)".The left part is the actual code, the right side the expansion it stands for.As Andrei lovely described, there is a _major_ visual (see the shape of the dots: circles vs. squares) and semantic difference between the ellipses (= "...") on the left and on the right. The left "..." is the actual C++11 pack operator and the right dots present the logical "imagine how this sequence continues"-operator instantiated in your head!So suppose your value list vs contains the values v1,v2,v3 then "func(5, vs)..." expands to "func(5, v1), func(5, v2), func(5, v3)"!Is this what you meant?

... in the templated f function. The first time through the templated f function, you could think of the tail_value_pack as being { "2", 3, "four" } and the f( g( tail_value_pack ) ... ) call as expanding to

f( g( "2" ), g( 3 ), g( "four" ) );

. Similarly for the recursive-looking overloaded calls to the templated f function. Once the tail_value_pack is empty, then you could think of the tail_value_pack as being { } and the f( g( tail_value_pack ) ... ) call as expanding to

f( );

... hence, the empty regular f function before the templated f function in the code above.