| 3342 | } |
| 3343 | |
| 3344 | void Value::resize(ArrayIndex newSize) { |
| 3345 | JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue, |
| 3346 | "in Json::Value::resize(): requires arrayValue"); |
| 3347 | if (type() == nullValue) |
| 3348 | *this = Value(arrayValue); |
| 3349 | ArrayIndex oldSize = size(); |
| 3350 | if (newSize == 0) |
| 3351 | clear(); |
| 3352 | else if (newSize > oldSize) |
| 3353 | for (ArrayIndex i = oldSize; i < newSize; ++i) |
| 3354 | (*this)[i]; |
| 3355 | else { |
| 3356 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 3357 | value_.map_->erase(index); |
| 3358 | } |
| 3359 | JSON_ASSERT(size() == newSize); |
| 3360 | } |
| 3361 | } |
| 3362 | |
| 3363 | Value& Value::operator[](ArrayIndex index) { |
| 3364 | JSON_ASSERT_MESSAGE( |