Version 0

Lecture: Expression Templates

How I Learned to Stop Worrying and Love Template Meta-Programming


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.


Day: 2013-07-14
Start time: 15:30
Duration: 00:30
Track: Practices




Click here to let us know how you liked this event.