Fixup Json::Value append methods, run clang format. (#1022)

This commit is contained in:
Jordan Bayles 2019-09-25 14:05:45 -07:00 committed by GitHub
parent 00b979f086
commit d448610770
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1155,10 +1155,14 @@ Value const& Value::operator[](CppTL::ConstString const& key) const {
} }
#endif #endif
Value& Value::append(const Value& value) { return (*this)[size()] = value; } Value& Value::append(const Value& value) { return append(Value(value)); }
Value& Value::append(Value&& value) { Value& Value::append(Value&& value) {
return (*this)[size()] = std::move(value); JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue,
"in Json::Value::append: requires arrayValue");
if (type() == nullValue) {
*this = Value(arrayValue);
}
return this->value_.map_->emplace(size(), std::move(value)).first->second;
} }
Value Value::get(char const* begin, Value Value::get(char const* begin,