January 2019
Intermediate to advanced
512 pages
14h 5m
English
The last kind of template in C++ is the variable template, which was introduced in C++14. This template allows us to define a variable with a generic type:
template <typename T>constexpr T pi = T(3.14159265358979323846264338327950288419716939937510582097494459230781L);pi<float>; // 3.141592pi<double>; // 3.141592653589793
Variable templates are not used in the rest of this book, so we will not mention them again.