That depends on what you're trying to accomplish.
Only one thing is for certain: don't try to access the second element of a vector that has less than two elements.
but i am removing 1st element in the vector. so why have run time error ? i think after removing i need to resize .but i checked many people example . they didnot resized it .
There's not enough context to determine what's causing your code to crash. Not respecting the new size of the vector was simply the most likely candidate.