From d0b3ebf32e86a865c965f6265385e69188f0a3e1 Mon Sep 17 00:00:00 2001 From: HanishKVC Date: Sun, 28 Apr 2024 18:41:26 +0530 Subject: [PATCH] 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. --- common/simpcfg.hpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/common/simpcfg.hpp b/common/simpcfg.hpp index b28839cce..313341721 100644 --- a/common/simpcfg.hpp +++ b/common/simpcfg.hpp @@ -63,16 +63,14 @@ private: std::map> mapBools = {}; public: 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; - mapStrings[group] = gm; 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) { - auto gm = mapBools[group]; + auto &gm = mapBools[group]; gm[key] = value; - mapBools[group] = gm; LDBUG_LN("DBUG:SC:%s:%s:%s:%d", __func__, group.c_str(), key.c_str(), value); }