As an example, I have a 2d vector and a 1d vector and I want to copy the first item from each row using std::copy_if from the algorithm library:
std::vector<std::vector<std::string>> names{ { "Allan", "Daniel", "Maria" }, {"John", "Louis", "Will"}, {"Bill", "Joe", "Nick"}};
So we'll have to copy "Allan", "John" and "Bill" into the destination vector which is dst
std::vector<std::string> dst;
Aucun commentaire:
Enregistrer un commentaire