diff --git a/api/source/mk_events_objects.cpp b/api/source/mk_events_objects.cpp index 69e9fa3a..f959668a 100644 --- a/api/source/mk_events_objects.cpp +++ b/api/source/mk_events_objects.cpp @@ -250,7 +250,7 @@ static C get_http_header( const char *response_header[]){ auto value = response_header[i + 1]; if (key && value) { i += 2; - header[key] = value; + header.emplace(key,value); continue; } break; diff --git a/api/source/mk_httpclient.cpp b/api/source/mk_httpclient.cpp index 0e32b472..e1262011 100755 --- a/api/source/mk_httpclient.cpp +++ b/api/source/mk_httpclient.cpp @@ -88,7 +88,7 @@ static C get_http_header( const char *response_header[]){ auto value = response_header[i + 1]; if (key && value) { i += 2; - header[key] = value; + header.emplace(key,value); continue; } break; diff --git a/src/Common/Parser.h b/src/Common/Parser.h index eaa1874d..bd15d0b8 100644 --- a/src/Common/Parser.h +++ b/src/Common/Parser.h @@ -28,27 +28,26 @@ class StrCaseMap : public multimap{ StrCaseMap() = default; ~StrCaseMap() = default; - template - string &operator[](K &&k){ - auto it = find(std::forward(k)); + string &operator[](const string &k){ + auto it = find(k); if(it == end()){ - it = Super::emplace(std::forward(k),""); + it = Super::emplace(k,""); } return it->second; } - template - void emplace(K &&k , V &&v) { - auto it = find(std::forward(k)); + template + void emplace(const string &k, V &&v) { + auto it = find(k); if(it != end()){ return; } - Super::emplace(std::forward(k),std::forward(v)); + Super::emplace(k,std::forward(v)); } - template - void emplace_force(K &&k , V &&v) { - Super::emplace(std::forward(k),std::forward(v)); + template + void emplace_force(const string k , V &&v) { + Super::emplace(k,std::forward(v)); } };