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