Skip to content

Commit

Permalink
Fixup Json::Value append methods, run clang format. (open-source-pars…
Browse files Browse the repository at this point in the history
  • Loading branch information
baylesj authored Sep 25, 2019
1 parent 00b979f commit d448610
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lib_json/json_value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1155,10 +1155,14 @@ Value const& Value::operator[](CppTL::ConstString const& key) const {
}
#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) {
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,
Expand Down

0 comments on commit d448610

Please sign in to comment.