Beware of C++11 `auto`

Here’s a puzzler for you: given the code below, what does the for loop print? using HandlersMap = std::map<std::string, std::function<std::string(const std::string&)>>; using MetaMap = std::map<std::string, HandlersMap>; void insert(MetaMap& meta, const std::string& key, const std::string& sub) { auto handlers = meta[key]; handlers[sub] = [=](const std::string& msg) { return “The response for ” + sub + ” … More Beware of C++11 `auto`