Remove from the beginning of std::vector

The Solution to Remove from the beginning of std::vector is


std::vector<Rule>& topPriorityRules;

The correct way to remove the first element of the referenced vector is


which is exactly what you suggested.

Looks like i need to do iterator overloading.

There is no need to overload an iterator in order to erase first element of std::vector.

P.S. Vector (dynamic array) is probably a wrong choice of data structure if you intend to erase from the front.

~ Answered on 2016-11-17 14:12:10

Most Viewed Questions: