| 3310 | } |
| 3311 | |
| 3312 | void Value::resize(ArrayIndex newSize) { |
| 3313 | JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue, |
| 3314 | "in Json::Value::resize(): requires arrayValue"); |
| 3315 | if (type() == nullValue) |
| 3316 | *this = Value(arrayValue); |
| 3317 | ArrayIndex oldSize = size(); |
| 3318 | if (newSize == 0) |
| 3319 | clear(); |
| 3320 | else if (newSize > oldSize) |
| 3321 | this->operator[](newSize - 1); |
| 3322 | else { |
| 3323 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 3324 | value_.map_->erase(index); |
| 3325 | } |
| 3326 | JSON_ASSERT(size() == newSize); |
| 3327 | } |
| 3328 | } |
| 3329 | |
| 3330 | Value &Value::operator[](ArrayIndex index) { |
| 3331 | JSON_ASSERT_MESSAGE( |