Simplify code with 'if constexpr' in C++17--Bartlomiej Filipek

With examples.

Simplify code with 'if constexpr' in C++17

by Bartlomiej Filipek

From the article:

Before C++17 we had a few, quite ugly looking, ways to write static if (if that works at compile time) in C++: you could use tag dispatching or SFINAE (for example via std::enable_if). Fortunately, that’s changed, and we can now take benefit of if constexpr!

Let’s see how we can use it and replace some std::enable_if code.

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.