Introduction

One of the most powerful language features that we get with C++17 is the compile-time if in the form of `if constexpr`. It allows you to check, at compile time, a condition and depending on the result the code is rejected from the further steps of the compilation. In this chapter, you’ll see one example of how this new feature can simplify the code.

We'll cover the following

The Problem

In item 18 of Effective Modern C++ Scott Meyers described a method called makeInvestment:

Get hands-on with 1400+ tech skills courses.