From: Otto Moerbeek Date: Fri, 29 Apr 2022 15:16:11 +0000 (+0200) Subject: Use emplace instead of insert X-Git-Tag: auth-4.8.0-alpha0~111^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b09a491f8a6f88a29d13f0af40744eccd6633295;p=thirdparty%2Fpdns.git Use emplace instead of insert --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index d8773c1ff4..5b6ccec2ff 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -237,6 +237,9 @@ public: struct entry_t { + entry_t(const Thing& thing_, time_t ttd_, unsigned int count_) : thing(thing_), ttd(ttd_), count(count_) + { + } Thing thing; time_t ttd; mutable unsigned int count; @@ -267,8 +270,7 @@ public: auto i = d_cont.find(t); time_t ttd = now + ttl; if (i == d_cont.end()) { - entry_t e = { t, ttd, count }; - d_cont.insert(e); + d_cont.emplace(t, ttd, count); } else if (ttd > i->ttd || count > i->count) { ttd = std::max(i->ttd, ttd); count = std::max(i->count, count);