Alice's Adventures in Template Land

Speaker: Jonathan O'Connor

Audience level: Intermediate


How do you go from just using templates to writing libraries that rely on template meta-programming magic?

Boost.MultiIndex container has a very nice way of defining indexes using:

member<Person, int, &Person::age>

However, why must we repeat Person, and why do we need to specify the type of Person::age, when the compiler already knows it? Why can't we just write:


This talk will not talk about Boost, but will look at how this kind of code could be implemented in C++17 using template meta-programming. It will describe the wrong paths attempted, the frustrations with the tools, and the epiphanies along the way.