Removes `n` values starting at index `i`, or returns false if the range is invalid */
| 108 | |
| 109 | /** Removes `n` values starting at index `i`, or returns false if the range is invalid */ |
| 110 | bool remove(size_t i, size_t n =1) { |
| 111 | if (_usuallyFalse(!MCollection::isMutable())) |
| 112 | return false; |
| 113 | size_t end = i + n; |
| 114 | if (end <= i) |
| 115 | return (end == i); |
| 116 | size_t cnt = count(); |
| 117 | if (_usuallyFalse(end > cnt)) |
| 118 | return false; |
| 119 | if (end < cnt) |
| 120 | populateVec(); |
| 121 | MCollection::mutate(); |
| 122 | _vec.erase(_vec.begin() + i, _vec.begin() + end); |
| 123 | return true; |
| 124 | } |
| 125 | |
| 126 | /** Removes all items from the array. */ |
| 127 | bool clear() { |