| 3450 | } |
| 3451 | |
| 3452 | void Value::resize(ArrayIndex newSize) { |
| 3453 | JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, |
| 3454 | "in Json::Value::resize(): requires arrayValue"); |
| 3455 | if (type_ == nullValue) |
| 3456 | *this = Value(arrayValue); |
| 3457 | ArrayIndex oldSize = size(); |
| 3458 | if (newSize == 0) |
| 3459 | clear(); |
| 3460 | else if (newSize > oldSize) |
| 3461 | (*this)[newSize - 1]; |
| 3462 | else { |
| 3463 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 3464 | value_.map_->erase(index); |
| 3465 | } |
| 3466 | JSON_ASSERT(size() == newSize); |
| 3467 | } |
| 3468 | } |
| 3469 | |
| 3470 | Value& Value::operator[](ArrayIndex index) { |
| 3471 | JSON_ASSERT_MESSAGE( |
no test coverage detected