We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00b979f commit d448610Copy full SHA for d448610
src/lib_json/json_value.cpp
@@ -1155,10 +1155,14 @@ Value const& Value::operator[](CppTL::ConstString const& key) const {
1155
}
1156
#endif
1157
1158
-Value& Value::append(const Value& value) { return (*this)[size()] = value; }
1159
-
+Value& Value::append(const Value& value) { return append(Value(value)); }
1160
Value& Value::append(Value&& value) {
1161
- return (*this)[size()] = std::move(value);
+ JSON_ASSERT_MESSAGE(type() == nullValue || type() == arrayValue,
+ "in Json::Value::append: requires arrayValue");
1162
+ if (type() == nullValue) {
1163
+ *this = Value(arrayValue);
1164
+ }
1165
+ return this->value_.map_->emplace(size(), std::move(value)).first->second;
1166
1167
1168
Value Value::get(char const* begin,
0 commit comments