Auto! Or: C++ is the New Python

I’ve just finished reading – again – “Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14” by Scott Meyers

I say again because I’ve read this book many times. And I have to confess: I understand but I do not get it.  Most of the start of the book is to make sense of one feature: auto. It is supposed to simplify the declaration of variables. Example:

std::map< std::string, struct ComponentInfo >::const_iterator it = mymap.find(“help!”);

becomes

auto it = mymap.find( “help!”);

Simple enough. But it leads to

I’ve posted a few weeks ago about how it is heartbreaking how the C++ language since C++11 a few years ago has been steering towards its own collapse. The main strengths of C++ – speed and strong typing – have been ignored in favor of ‘sex-of-the-angels’ computer science, academic self-pleasure.

Today C++ sounds like python. With auto, you can mimic the “duct typing” of python and that brings the same problems – a variable declared this way can take many types, be passed by reference or value. The rules are