fixed GH #1355: [JSON::Object] After copy-ctor, JSON::Object::_keys still points to keys in map of copied object

This commit is contained in:
Günter Obiltschnig
2016-08-27 10:54:35 +02:00
parent 4232d0b497
commit f9f4c54bc3
2 changed files with 23 additions and 1 deletions

View File

@@ -303,6 +303,19 @@ inline std::size_t Object::size() const
inline void Object::remove(const std::string& key)
{
_values.erase(key);
if (_preserveInsOrder)
{
KeyPtrList::iterator it = _keys.begin();
KeyPtrList::iterator end = _keys.end();
for (; it != end; ++it)
{
if (key == **it)
{
_keys.erase(it);
break;
}
}
}
}