The auto surprise
If you, dear reader, do remember that in Chapter 9, we had an interesting section called The definition of zero, then all is good. That’s because our next pitch will be about this highly influential number again. If you don’t remember that chapter, then life is still good, because hopefully, you have purchased a full book with all the chapters inside, and you can turn the pages back to read it (again).
Let’s consider the following program:
#include <iostream> #include <typeinfo> #include <string> template<typename T> std::string typeof(T t) { std::string res = typeid(t).name(); return res; } int main() { auto a1 = 0; auto a2(0); auto a3 {0}; auto a4 = {0}; std::cout << typeof(a1) << std::endl ...