Hi, I am trying to get something that will actually delete some contents in a vector?
For example, i have a vector<double> vector1;
and i have a for loop that does whatever which will access the contents in the vector1 when some criteria is met. therefore not accessing the vector in an ordered manner. After that, the remaining elements in the vector will be used somewhere again, multiple times.
How can i achieve this??
Any help will be appreciated, but please be specific. I am not that pro on C++, thanks.
Kent
kentigens
21
Newbie Poster
Recommended Answers
Jump to PostA vector has a lot of functions associated with it that you can use, including removing elements (erase):
http://www.cplusplus.com/reference/stl/vector/You should read up on vector iterators, they are really handy to use. Google is your friend here.
Of course if you don't understand something about it …
All 2 Replies
Reply to this topic
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.