std::map<std::string, uint32_t> dictionary std::set<const std::string *> keySet; // std::back_inserter(keyVector) std::transform(dictionary.begin(), dictionary.end(), std::inserter(keySet, keySet.end()), [](std::pair<const std::string, uint32_t> &pair) { return &(pair.first); }); //---------------------- 标签:std,map,dictionary,inserter,C++,keySet,pair From: https://www.cnblogs.com/gispathfinder/p/17000577.html