Expression Templates -- Volker Krause

volker-krause.jpgFrom this month's KDE Akademy conference:

Expression Templates: How I Learned to Stop Worrying and Love Template Meta-Programming (30 min video) (slides)

by Volker Krause

The speaker's opening words should be enough to get you to set aside a half hour:

"I'm going to talk about template metaprogramming in general and expression templates in particular. And that's obviously something we use every day. <laughter> You laugh, but in half an hour you will see that we actually do..."

 

Abstract:

Contrary to common perception, expression templates are not bizarre meta-programming theory but something you are (possibly unknowingly) using every day. We'll see what they are good for, how they work and and what to do if they don't.

Originally invented by Todd Veldhuizen for the use in the math library Blitz++, expression templates are often seen as one of those esoteric applications of C++ template meta-programming that results in completely incomprehensible code that only Marc and Thiago understand at best, and that gives you compiler errors longer than an average discussion on the right display manager.

In this talk we will try to counter this (wrong) perception, by looking at why and how this (syntactically) indeed somewhat complex code results in very elegant API and often outperforms conventional implementations. On the way we will see that C++ template meta-programming code is actually not that scary, and that template-related compiler errors aren't that bad either.

Now why would this be of interest to the average Qt or KDE developer? Well, since the introduction of QStringBuilder in Qt 4.7 we have expression templates for a very common use case, string concatenations. And if your code is somewhere in KDE Git, it's very likely Laurent enabled the use of QStringBuilder for you already. So, we are not talking about exotic theory here, but about tools you are using every day.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.