| 904 | } |
| 905 | |
| 906 | void Value::resize(ArrayIndex newSize) { |
| 907 | JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue, |
| 908 | "in Json::Value::resize(): requires arrayValue"); |
| 909 | if (type() == nullValue) |
| 910 | *this = Value(arrayValue); |
| 911 | ArrayIndex oldSize = size(); |
| 912 | if (newSize == 0) |
| 913 | clear(); |
| 914 | else if (newSize > oldSize) |
| 915 | for (ArrayIndex i = oldSize; i < newSize; ++i) |
| 916 | (*this)[i]; |
| 917 | else { |
| 918 | for (ArrayIndex index = newSize; index < oldSize; ++index) { |
| 919 | value_.map_->erase(index); |
| 920 | } |
| 921 | JSON_ASSERT(size() == newSize); |
| 922 | } |
| 923 | } |
| 924 | |
| 925 | Value& Value::operator[](ArrayIndex index) { |
| 926 | JSON_ASSERT_MESSAGE( |
no test coverage detected