MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / erase_at

Function erase_at

include/chaiscript/dispatchkit/bootstrap_stl.hpp:160–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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>

Callers

nothing calls this directly

Calls 2

beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected