I am trying to delete an element in my vector but my program crashes after each run. The vector is loaded with integers.

vector<int> vec(30);
vec.erase(vec.begin() + 5);

Is this the proper way to delete from a vector?

There's nothing wrong with that code. Try to post code that reproduces the error you are experiencing.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.