I attended this pair of sessions by Jody Hagins, and then went back and watched them again at unholy hours in the morning.
Note: As an attendee, I can munch on the sessions before they’re officially posted on the YouTube CPPCON Channel, in case you’re wondering why you can’t access them Once they’re availlable, munch away!.
These sessions are easy going, with a ping back to Walter Brown’s “seminal” pair of corresponding talks, Modern Template Metaprogramming: A Compendium: Part I and Modern Template Metaprogramming: A Compendium: Part II, both given during CPPCON2014 and at the end of this post for your enjoyment. If you have half a day to spend munching on metaprogramming, this set of four talks should get you going on the road to master template metaprogramming, grasshopper.
Before you start munching, you can find the Type Traits referred in these talks in cppreference, or, if you prefer Spanish, you can find them in es.cppreference,
Holy Cow, the Book of Coplien!
Couldn’t help but smile when Jody pulled out a copy of the “Purple Book” of Advanced C++. That’s where I learned the word “functor”. Used to keep a copy–along with a copy of the C++ ARM (when ARM was an acronym for Annotated Reference Manual) but alas, both have been lost in time.
With the homage to Coplien and Boost Type Traits, pioneers and base for what we now see in C++ type traits, correspondingly, Jody digs in.
Part 1
In short, the first session , convention for type traits that yield a ::value, that yield a ::type, value metafunctions (those using a _v suffix), type metafunctions (those using a _t suffix; Jody peels away the mystery of std::integral_constant
and ventures into the is_void
as an example on how to remove cv-qualifiers.
Part 2
Part 2 picks up with a review of the different categories of type traits (primary, composite type, type properties, etc.). Template specialization will be used abundantly, so be ready. A cursory review will help.
Now, in case you wondered, SFINAE is not a cursing word in Spanish–or any other language for that matter, but, along with CRTP, and RAII, it’s one of those acronyms that once you’ve spent time in C++, you’ll learn by heart.
How About those Other Talks?
Walter Brown’s Talks can be found here: