Insert a number of elements into the buffer setting their value. Inserting at positions outside the current range fails.
| 167 | /// Insert a number of elements into the buffer setting their value. |
| 168 | /// Inserting at positions outside the current range fails. |
| 169 | void InsertValue(int position, int insertLength, T v) { |
| 170 | PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); |
| 171 | if (insertLength > 0) { |
| 172 | if ((position < 0) || (position > lengthBody)) { |
| 173 | return; |
| 174 | } |
| 175 | RoomFor(insertLength); |
| 176 | GapTo(position); |
| 177 | std::fill(&body[part1Length], &body[part1Length + insertLength], v); |
| 178 | lengthBody += insertLength; |
| 179 | part1Length += insertLength; |
| 180 | gapLength -= insertLength; |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | /// Ensure at least length elements allocated, |
| 185 | /// appending zero valued elements if needed. |
no outgoing calls
no test coverage detected