| 3364 | } |
| 3365 | |
| 3366 | void Value::resize(ArrayIndex newSize) { |
| 3367 | JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, |
| 3368 | "in Json::Value::resize(): requires arrayValue"); |
| 3369 | if (type_ == nullValue) |
| 3370 | *this = Value(arrayValue); |
| 3371 | ArrayIndex oldSize = size(); |
| 3372 | if (newSize == 0) |
| 3373 | clear(); |
| 3374 | else if (newSize > oldSize) |
| 3375 | (*this)[newSize - 1]; |
| 3376 | else { |
| 3377 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 3378 | value_.map_->erase(index); |
| 3379 | } |
| 3380 | assert(size() == newSize); |
| 3381 | } |
| 3382 | } |
| 3383 | |
| 3384 | Value& Value::operator[](ArrayIndex index) { |
| 3385 | JSON_ASSERT_MESSAGE( |
no test coverage detected