50int RemoveAt(RepeatedType* array,
const IndexContainer& indices) {
51 if (indices.size() == 0) {
54 const int num_indices = indices.size();
55 const int num_elements = array->size();
56 DCHECK_LE(num_indices, num_elements);
57 if (num_indices == num_elements) {
62 typename IndexContainer::const_iterator remove_iter = indices.begin();
63 int write_index = *(remove_iter++);
64 for (
int scan = write_index + 1; scan < num_elements; ++scan) {
65 if (remove_iter != indices.end() && *remove_iter == scan) {
68 array->SwapElements(scan, write_index++);
71 DCHECK_EQ(write_index, num_elements - num_indices);