Skip to content
Browse files

Common/IniFile: Simplify Set()

We can just utilize map's insert_or_assign() function and check the
return value to determine whether or not we need to insert the key into
the keys_order vector.
  • Loading branch information...
lioncash committed May 23, 2019
1 parent e2c769a commit 869acb96c6416f11a53670652ae8802907022f58
Showing with 4 additions and 7 deletions.
  1. +4 −7 Source/Core/Common/IniFile.cpp
@@ -47,14 +47,11 @@ IniFile::Section::Section(std::string name_) : name{std::move(name_)}

void IniFile::Section::Set(const std::string& key, std::string new_value)
auto it = values.find(key);
if (it != values.end())
it->second = std::move(new_value);
values[key] = std::move(new_value);
const auto result = values.insert_or_assign(key, std::move(new_value));
const bool insertion_occurred = result.second;

if (insertion_occurred)

bool IniFile::Section::Get(const std::string& key, std::string* value,

0 comments on commit 869acb9

Please sign in to comment.
You can’t perform that action at this time.