| 158 | /// Algorithm for erasing a specific position from a container |
| 159 | template<typename Type> |
| 160 | void erase_at(Type &container, int pos) |
| 161 | { |
| 162 | auto itr = container.begin(); |
| 163 | auto end = container.end(); |
| 164 | |
| 165 | if (pos < 0 || std::distance(itr, end) < (pos-1)) |
| 166 | { |
| 167 | throw std::range_error("Cannot erase past end of range"); |
| 168 | } |
| 169 | |
| 170 | std::advance(itr, pos); |
| 171 | container.erase(itr); |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | template<typename ContainerType> |