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