C++14 using auto keyword in a method's definition
问题 I have several std::unordered_maps . They all have an std::string as their key and their data differs. I want to make a csv string from a given map's keys because that data needs to be sent over the wire to a connected client. At the moment I have a method for each individual map. I wanted to make this generic and I came up with the following : std::string myClass::getCollection(auto& myMap) { std::vector <std::string> tmpVec; for ( auto& elem : myMap) { tmpVec.push_back(elem.first); } std: