| 3392 | } |
| 3393 | |
| 3394 | void Value::resize(ArrayIndex newSize) { |
| 3395 | JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, |
| 3396 | "in Json::Value::resize(): requires arrayValue"); |
| 3397 | if (type_ == nullValue) |
| 3398 | *this = Value(arrayValue); |
| 3399 | ArrayIndex oldSize = size(); |
| 3400 | if (newSize == 0) |
| 3401 | clear(); |
| 3402 | else if (newSize > oldSize) |
| 3403 | (*this)[newSize - 1]; |
| 3404 | else { |
| 3405 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 3406 | value_.map_->erase(index); |
| 3407 | } |
| 3408 | JSON_ASSERT(size() == newSize); |
| 3409 | } |
| 3410 | } |
| 3411 | |
| 3412 | Value& Value::operator[](ArrayIndex index) { |
| 3413 | JSON_ASSERT_MESSAGE( |
no test coverage detected