if constexpr

Issue #282 new
Matthias Moulin created an issue

I was a bit surprised upon searching the complete Blaze repository of not finding any if constexpr statements. Manyif statements, however, could (depending on the compiler) benefit from usingif constexpr statements instead, as this will force the compiler to elide the branch independent of optimization flags.

For example: SO checks in Dense.h.

Comments (4)

  1. Klaus Iglberger

    Hi Matthias!

    You are correct, Blaze does not use any if constexpr yet. The reason is that Blaze is a C++14 library throughout the 3.x releases (see also the “Compiler Compatibility” section on the main Blaze page) and if constexpr is a C++17 feature. Using if constexpr would therefore be a breaking change. We will, however, move to C++17 with the 4.0 release and with that will be able to use if constexpr.

    We will leave this issue open as a reminder. Thanks,

    Best regards,

    Klaus!

  2. Thorsten Schmitz

    Hi Klaus,

    Do you already have plans where exactly in blaze you are going to use if constexpr ?

    Best regards

    Thorsten

    ps: Do you already have a rough release date in mind for 4.0?

  3. Klaus Iglberger

    Hi Thorsten!

    1. Everywhere. if constexpr will result in the largest refactoring that Blaze has ever experienced (and probably will ever experience).
    2. There will be a Blaze 3.7 and perhaps a Blaze 3.8 (if necessary). After that we plan to release Blaze 4.0. Since we release approx. every half year, you can consider this a rough schedule.

    Best regards,

    Klaus!

  4. Log in to comment