Initialize a container with iterator range of container with different type
问题 Let's say we have std::set<int> and we want to create a std::vector<int> with all values from that set: std::set<int> set; std::vector<int> vec( set.begin(), set.end() ); This is simple and elegant. But let's say I have a std::map<std::string,int> and I want to copy all values to std::vector<int> . Unfortunately there is no constructor, that accepts range of iterators and converter function. Why there is no such constructor provided? Is there another simple and elegant way to initialize one