Monday, 25 March 2019

C++ Variadic Template Compiler Optimizations

In my prior post we briefly talked about how the compiler unrolls a variadic template and we needed to provide the end-point function to stop that iteration, lets take a closer look at how the compiler does this unrolling.

The impact this has on your debug build is critical, and I demonstrate that you can see the unrolling of numeric functions (such as summation) but then in release the compiler is smart enough to optimize that all away and use a constant.  Understanding when this is happening is a crucial lesson, as we then see the action of a repetitive string output.


If you found these two little videos of any use, please life & subscribe on YouTube to let me know!

And as always the comments below are available.

1 comment:

  1. This comment has been removed by a blog administrator.

    ReplyDelete