| 966 | } |
| 967 | |
| 968 | void Value::resize(ArrayIndex newSize) { |
| 969 | JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, |
| 970 | "in Json::Value::resize(): requires arrayValue"); |
| 971 | if (type_ == nullValue) |
| 972 | *this = Value(arrayValue); |
| 973 | ArrayIndex oldSize = size(); |
| 974 | if (newSize == 0) |
| 975 | clear(); |
| 976 | else if (newSize > oldSize) |
| 977 | this->operator[](newSize - 1); |
| 978 | else { |
| 979 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 980 | value_.map_->erase(index); |
| 981 | } |
| 982 | JSON_ASSERT(size() == newSize); |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | Value& Value::operator[](ArrayIndex index) { |
| 987 | JSON_ASSERT_MESSAGE( |
no test coverage detected