Add an insert overload function (#1110)

This commit is contained in:
Chen
2019-12-03 09:13:42 +08:00
committed by GitHub
parent 9e0d70aa66
commit a0bd9adfef
3 changed files with 9 additions and 4 deletions

View File

@@ -1126,7 +1126,11 @@ Value& Value::append(Value&& value) {
return this->value_.map_->emplace(size(), std::move(value)).first->second;
}
bool Value::insert(ArrayIndex index, Value newValue) {
bool Value::insert(ArrayIndex index, const Value& newValue) {
return insert(index, Value(newValue));
}
bool Value::insert(ArrayIndex index, Value&& newValue) {
JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue,
"in Json::Value::insert: requires arrayValue");
ArrayIndex length = size();