How can I insert element into beginning of vector?
问题 i'm newbie in writing code and i need a little help.I need to insert values into the beginning of a std::vector and i need other values in this vector to be pushed to further positions for example: something added to beginning of a vector and values moved from position 1 to 2, from 2 to 3 etc. how do i do that? 回答1: Use std::vector::insert function accepting iterator to the first element as a target position (iterator before which to insert the element): #include <vector> int main() { std: