问题 I'm looking to insert values into a std::vector in a way like std::transform. std::transform needs a pre-sized third argument, but in my case, the size depends on transformers() and is not predictable. ... // std::vector<int> new_args(); <-- not working std::vector<int> new_args(args.size()); std::transform(args.begin(),args.end(),new_args.begin(),transformers()); Is there a std:transform-ish way to insert values into a std::vector? 回答1: You do not need to pre size the vector that is going to