Debug Printing
Now, we shall study a print function which uses several new facilities of C++.
We'll cover the following...
We'll cover the following...
In this lesson we’ll examine a few more functions available in C++17. Do not worry about the code itself.
Here are all the functions and utilities you need to focus on:
if constexpr_vtemplateslinePrinter
Here you can see the following features:
• Line 5, 7, 11: if constexpr - to discard code at compile time, used to match the template
parameter.
• Line 5, 7, 11: _v variable templates for type traits - no need to write std::trait_name<T>::value.
• Line 20: Fold Expressions inside printWithInfo. This feature simplifies variadic templates. In
the example we invoke linePrinter() over all input arguments.
What we have seen here is just a small shadow of what’s to come ahead. See you in the next section!