| 882 | } |
| 883 | |
| 884 | void Value::resize(ArrayIndex newSize) { |
| 885 | JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, |
| 886 | "in Json::Value::resize(): requires arrayValue"); |
| 887 | if (type_ == nullValue) |
| 888 | *this = Value(arrayValue); |
| 889 | ArrayIndex oldSize = size(); |
| 890 | if (newSize == 0) |
| 891 | clear(); |
| 892 | else if (newSize > oldSize) |
| 893 | (*this)[newSize - 1]; |
| 894 | else { |
| 895 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 896 | value_.map_->erase(index); |
| 897 | } |
| 898 | assert(size() == newSize); |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | Value& Value::operator[](ArrayIndex index) { |
| 903 | JSON_ASSERT_MESSAGE( |
no test coverage detected