Say I have a vector with values [1,2,3,4,5,6,7,8,9,10]. I want to create a new vector that refers to, for example, [5,6,7,8]. I imagine this is just a matter of creating a v
You don't have to use push_back if you don't want to, you can use std::copy:
push_back
std::copy
std::vector subvector; copy ( v1.begin() + 4, v1.begin() + 8, std::back_inserter(subvector) );