part of a stl vector

Started by
2 comments, last by daniel_i_l 17 years, 12 months ago
If I have 2 vectors of pointers like this: vector<CClass*> vPoint; vector<CClass*> vNext; and I want to put the first 10 pointers of vPoint into vNext, how do I do it? Thanks.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky
Advertisement
std::copy(vPoint.begin(), vPoint.begin()+10, vNext.begin())


might work.

Edit: Evil Steve's is better.
Off the top of my head:
vNext.insert(vNext.end(), vPoint.begin(), vPoint.begin()+10);
Thanks everyone.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the internet, we know this is not true." -- Professor Robert Silensky

This topic is closed to new replies.

Advertisement