This commit is contained in:
Alex Fabijanic
2015-06-09 22:41:38 -05:00
parent c5dca8e3ff
commit 5a5509a3e3
6 changed files with 72 additions and 39 deletions

View File

@@ -107,16 +107,16 @@ const std::string& Object::getKey(KeyPtrList::const_iterator& iter) const
ValueMap::const_iterator end = _values.end();
for (; it != end; ++it)
{
if (it->second == **iter) return it->first;
if (it->first == **iter) return it->first;
}
throw NotFoundException((*iter)->convert<std::string>());
throw NotFoundException(**iter);
}
void Object::set(const std::string& key, const Dynamic::Var& value)
{
_values[key] = value;
std::pair<ValueMap::iterator, bool> ret = _values.insert(ValueMap::value_type(key, value));
if (_preserveInsOrder)
{
KeyPtrList::iterator it = _keys.begin();
@@ -125,7 +125,7 @@ void Object::set(const std::string& key, const Dynamic::Var& value)
{
if (key == **it) return;
}
_keys.push_back(&_values[key]);
_keys.push_back(&ret.first->first);
}
}