aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-11 14:35:54 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-12 16:22:06 +0100
commit05e71a72fdc6da3fb319edc67b723999285c9657 (patch)
tree282fa9644390c46cb029cde057267c035edcb301
parent29195491c25bcba50b78a30c779db07913f87d3a (diff)
downloadlibquotient-05e71a72fdc6da3fb319edc67b723999285c9657.tar.gz
libquotient-05e71a72fdc6da3fb319edc67b723999285c9657.zip
Fix a few quirks in converters.h
-rw-r--r--lib/converters.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/converters.h b/lib/converters.h
index cc6378e4..2df18b03 100644
--- a/lib/converters.h
+++ b/lib/converters.h
@@ -242,12 +242,11 @@ struct JsonObjectConverter<QSet<QString>> {
for (const auto& e : s)
json.insert(toJson(e), QJsonObject {});
}
- static auto fillFrom(const QJsonObject& json, QSet<QString>& s)
+ static void fillFrom(const QJsonObject& json, QSet<QString>& s)
{
s.reserve(s.size() + json.size());
for (auto it = json.begin(); it != json.end(); ++it)
s.insert(it.key());
- return s;
}
};
@@ -260,7 +259,7 @@ struct HashMapFromJson {
}
static void fillFrom(const QJsonObject& jo, HashMapT& h)
{
- h.reserve(jo.size());
+ h.reserve(h.size() + jo.size());
for (auto it = jo.begin(); it != jo.end(); ++it)
h[it.key()] = fromJson<typename HashMapT::mapped_type>(it.value());
}