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