cpp split vector in half code example
Example: split vector in half cpp
std::vector<int> vec = {89, 15, 51, 27, 98};
std::size_t const half_size = vec.size() / 2;
std::vector<int> half1(vec.begin(), vec.begin() + half_size);
std::vector<int> half2(vec.begin() + half_size, vec.end());