Inserts the value `val` into the array at index `i`, or returns false if the array is out of range (greater than the count.) */
| 90 | /** Inserts the value `val` into the array at index `i`, |
| 91 | or returns false if the array is out of range (greater than the count.) */ |
| 92 | bool insert(size_t i, Native val) { |
| 93 | if (_usuallyFalse(!MCollection::isMutable())) |
| 94 | return false; |
| 95 | size_t cnt = count(); |
| 96 | if (_usuallyFalse(i > cnt || val == nullptr)) |
| 97 | return false; |
| 98 | else if (i < cnt) |
| 99 | populateVec(); |
| 100 | MCollection::mutate(); |
| 101 | _vec.emplace(_vec.begin() + i, val); |
| 102 | return true; |
| 103 | } |
| 104 | |
| 105 | bool append(Native val) { |
| 106 | return insert(count(), val); |