• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

vector question in C++

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

LittlePiggie

Member
Joined
Sep 30, 2002
Location
Oregon
I need to insert elements into the beginning of a vector and can't remember the name of the function. to add elements to the end I would use vector.push_back( var ) and to remove from the end, vector.pop_back( ). I want to know how add a ne wfirst element, moving existing elements back, and how to take out the first element. Thanks all.
 
Are you using the built in vector type (declared as "int x[y]" without quotes, and where y is the size) or some other vector class such as apvector? If you are using another vecotr class, please post the contents of the header file.
 
I'm using the <vector> header. I read all the functions in a reference book and there were functions for insertinf elements, but I can't remember exactly what they were.
 
Back