diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-11-11 14:35:54 +0100 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2021-11-11 22:18:42 +0100 |
commit | a4f34202b47f91f7fdfbe2006b2eae10b9b8eeac (patch) | |
tree | b716a8f44e3bca242ce8f0b5d587cbc017ebc31b /lib | |
parent | 65bb0b5fcf029df7a9bfa0b7b7b7e3203fd7862f (diff) | |
download | libquotient-a4f34202b47f91f7fdfbe2006b2eae10b9b8eeac.tar.gz libquotient-a4f34202b47f91f7fdfbe2006b2eae10b9b8eeac.zip |
Fix a few quirks in converters.h
Diffstat (limited to 'lib')
-rw-r--r-- | lib/converters.h | 5 |
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()); } |