| 981 | } |
| 982 | |
| 983 | void Value::resize(ArrayIndex newSize) { |
| 984 | JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, |
| 985 | "in Json::Value::resize(): requires arrayValue"); |
| 986 | if (type_ == nullValue) |
| 987 | *this = Value(arrayValue); |
| 988 | ArrayIndex oldSize = size(); |
| 989 | if (newSize == 0) |
| 990 | clear(); |
| 991 | else if (newSize > oldSize) |
| 992 | (*this)[newSize - 1]; |
| 993 | else { |
| 994 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 995 | value_.map_->erase(index); |
| 996 | } |
| 997 | JSON_ASSERT(size() == newSize); |
| 998 | } |
| 999 | } |
| 1000 | |
| 1001 | Value& Value::operator[](ArrayIndex index) { |
| 1002 | JSON_ASSERT_MESSAGE( |
no test coverage detected