SimpCfg: Use & wrt destination of [] operation
so that one can update the value-item's content, without needing to explicitly update/store the value-item back into map after the content has been updated. This should make these setting operations/helpers more efficient.
This commit is contained in:
parent
0a534e6897
commit
d0b3ebf32e
1 changed files with 2 additions and 4 deletions
|
@ -63,16 +63,14 @@ private:
|
||||||
std::map<std::string, std::map<std::string, bool>> mapBools = {};
|
std::map<std::string, std::map<std::string, bool>> mapBools = {};
|
||||||
public:
|
public:
|
||||||
void set_string(const std::string &group, const std::string &key, const std::string &value) {
|
void set_string(const std::string &group, const std::string &key, const std::string &value) {
|
||||||
auto gm = mapStrings[group];
|
auto &gm = mapStrings[group];
|
||||||
gm[key] = value;
|
gm[key] = value;
|
||||||
mapStrings[group] = gm;
|
|
||||||
LDBUG_LN("DBUG:SC:%s:%s:%s:%s", __func__, group.c_str(), key.c_str(), value.c_str());
|
LDBUG_LN("DBUG:SC:%s:%s:%s:%s", __func__, group.c_str(), key.c_str(), value.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_bool(const std::string &group, const std::string &key, bool value) {
|
void set_bool(const std::string &group, const std::string &key, bool value) {
|
||||||
auto gm = mapBools[group];
|
auto &gm = mapBools[group];
|
||||||
gm[key] = value;
|
gm[key] = value;
|
||||||
mapBools[group] = gm;
|
|
||||||
LDBUG_LN("DBUG:SC:%s:%s:%s:%d", __func__, group.c_str(), key.c_str(), value);
|
LDBUG_LN("DBUG:SC:%s:%s:%s:%d", __func__, group.c_str(), key.c_str(), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue