C++ copy specified vector content to another vector

c++, copy, vector

Solution

There's a constructor for `std::vector` (number 4 in this link) that takes two iterators. It constructs a new vector including all elements from the first iterator (inclusive) to the second iterator (exclusive).

std::vector<std::string> partOfMero(mero.begin() + 100, mero.begin() + 250);

This will include `mero[100]` through `mero[249]` in the newly-constructed vector.

Problem

I created a vector: ``` std::vector<std::string> mero; // earlier it filled with more than 500 data ``` After that I would like to create another vector which only takes a portion of the `mero` vector. (example: from 100th to 250th)

Original source

Related problems