CppCon 2016: Roland Bock “How to test static_assert?"

2,762 views · Published 5 October 2016 · 57:53 · Indexed 24 September 2026

Channel: CppCon · 2016 · Education

Watch on YouTube

http://CppCon.org
—
Presentation Slides, PDFs, Source Code and other presenter materials are available at: https://github.com/cppcon/cppcon2016
—
static_assert gives us the ability to assert conditions at compile time and provide custom error messages in case the conditions are not met. Cool! But how can you be sure that your precious static_asserts actually fire when you need them? There is only one way to know for sure: 

You need to test your static_assert! 

That is easier said than done, though, as static_assert produces a hard, unrecoverable compile-time error. For instance, you cannot test one static_assert with another. 

This talk will demonstrate several options for testing static_assert, ranging from the build system, over the compiler features to template meta programming. It will include real-life examples from sqlpp11. 
— 
Roland Bock
PPRO Financial Ltd
Principal Software Engineer
Munich Area, Germany
From my days at the university, I hold a PHD in physics (although that was in the previous century and seems like a different life by now). Ever since then I have been developing software and/or managing engineering teams. In 2008, I started to learn C++ because I could not believe that it was as difficult as some people claimed. Turns out they were totally wrong and totally right at the same time.

Today, I am still learning and I hope to continue to do so for a very long time!

I am the author of the libraries sqlpp11 and kiss-templates.

Apart from C++ itself, I'd be particularly interested in talking about strategies for hiring C++ engineers.
—
Videos Filmed & Edited by Bash Films: http://www.BashFilms.com 

Work at Hudson River Trading (HRT): https://tinyurl.com/safxfctf

More from this channel