| 3404 | } |
| 3405 | |
| 3406 | void Value::resize(ArrayIndex newSize) { |
| 3407 | JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, |
| 3408 | "in Json::Value::resize(): requires arrayValue"); |
| 3409 | if (type_ == nullValue) |
| 3410 | *this = Value(arrayValue); |
| 3411 | ArrayIndex oldSize = size(); |
| 3412 | if (newSize == 0) |
| 3413 | clear(); |
| 3414 | else if (newSize > oldSize) |
| 3415 | this->operator[](newSize - 1); |
| 3416 | else { |
| 3417 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 3418 | value_.map_->erase(index); |
| 3419 | } |
| 3420 | JSON_ASSERT(size() == newSize); |
| 3421 | } |
| 3422 | } |
| 3423 | |
| 3424 | Value& Value::operator[](ArrayIndex index) { |
| 3425 | JSON_ASSERT_MESSAGE( |
no test coverage detected