Loading…
CppCon 2018 has ended
Back To Schedule
Tuesday, September 25 • 15:50 - 16:20
Talking to Typelists

Sign up or log in to save this to your schedule, view media, leave feedback and see who's attending!

Talking to Typelists

Type sequences implemented with variadic templates have largely supplanted the traditional use of typelists in new C++ code. However, we have nearly two decade’s worth of complex, debugged, and useful legacy typelist code that we’d like to leverage for use with type sequences without having to rewrite them.

Additionally, modern C++ metaprogramming makes extensive use of index sequences as well as type sequences. Many index sequence meta‐algorithms are logically similar to corresponding meta‐algorithms on typelists (and type sequences). Wouldn’t it be convenient to simply and automatically convert a typelist meta‐algorithm into a functionally‐similar index sequence meta‐algorithm?

To be concrete, if we have Sort meta‐algorithm that sorts a typelist with a compile‐time comparator that compares types, wouldn’t it be nice to generate automatically a sort_is meta‐algorithm that sorts an index sequence with a compile‐time comparator that compares indexes? You bet it would!

In this presentation, attendees will learn how useful alias templates are both for syntactic cleanup and to implement advanced template metaprogramming techniques, and we'll see that there really is not a lot of difference among techniques for the manipulation of collections of types, values, and templates at compile time.

Speakers
avatar for Stephen Dewhurst

Stephen Dewhurst

President, Semantics Consulting, Inc.
Steve Dewhurst is the co-founder and president of Semantics Consulting, Inc. Steve is the author of numerous technical articles on C++ programming techniques and compiler design, is the author of the critically acclaimed books C++ Common Knowledge and C++ Gotchas, and is the co-author... Read More →


Tuesday September 25, 2018 15:50 - 16:20 PDT
Telluride (407)