* Inserts the specified number of elements at a specific location in the array. * @param index Index into the array where the elements will be inserted * @param n The number of elements to insert * @param val The value to insert */
| 371 | * @param val The value to insert |
| 372 | */ |
| 373 | void insert(size_t index, size_t n, const T& val = T()) { |
| 374 | if (index >= _count) { |
| 375 | // Append to the end of the array |
| 376 | size_t oldCount = _count; |
| 377 | setCount(index + n); |
| 378 | for (size_t i = oldCount; i < _count; i++) |
| 379 | get(i) = val; |
| 380 | } |
| 381 | else { |
| 382 | setCount(_count + n); |
| 383 | for (size_t i = _count-1; i >= index+n; i--) |
| 384 | get(i) = get(i-n); |
| 385 | for (size_t i = index; i < index+n; i++) |
| 386 | get(i) = val; |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | /** |
| 391 | * Inserts an object at a specific index in the daeArray, growing the array if neccessary |
no test coverage detected