I have a std::vector<std::pair<int,double>>, is there a quick way in terms of code length and speed to obtain:
- a
std::vector<double>on the second element - a
std::vector<double>::const_iteratoron the second element without creating a new vector
I did not manage to find a similar question in the list of questions highlighted when typing the question.
For the first question, you can use transform (with a lambda from c++11 in my example below).
For the second question, i don’t think you can have that.