overload append function for R value references.

This commit is contained in:
Dhruv Paranjape 2017-07-08 17:30:47 +05:30
parent 8996c377aa
commit 23c44d9f9e
2 changed files with 8 additions and 0 deletions

View File

@ -447,6 +447,10 @@ Json::Value obj_value(Json::objectValue); // {}
/// Equivalent to jsonvalue[jsonvalue.size()] = value;
Value& append(const Value& value);
#ifdef JSON_HAS_RVALUE_REFERENCES
Value& append(Value&& value);
#endif
/// Access an object value by name, create a null member if it does not exist.
/// \note Because of our implementation, keys are limited to 2^30 -1 chars.
/// Exceeding that will cause an exception.

View File

@ -1145,6 +1145,10 @@ Value const& Value::operator[](CppTL::ConstString const& key) const
Value& Value::append(const Value& value) { return (*this)[size()] = value; }
#ifdef JSON_HAS_RVALUE_REFERENCES
Value& Value::append(Value&& value) { return (*this)[size()] = value; }
#endif
Value Value::get(char const* key, char const* cend, Value const& defaultValue) const
{
Value const* found = find(key, cend);