mercredi 4 novembre 2015

Replacing std::transform, inserting into a std::vector

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?

Aucun commentaire:

Enregistrer un commentaire