diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-09-08 18:36:44 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-09-08 18:36:44 +0900 |
commit | c87b4d9dcaacd932cbb7e4a9dca00c55b6338eef (patch) | |
tree | acc32d16f3e8b3ced8a3a9b4894c34e6b1e7f6d1 | |
parent | e3ae4840e3082cbd30b4f699ef142787187ef688 (diff) | |
download | libquotient-c87b4d9dcaacd932cbb7e4a9dca00c55b6338eef.tar.gz libquotient-c87b4d9dcaacd932cbb7e4a9dca00c55b6338eef.zip |
Better toJson for container objects
The previous version couldn't deal with containers of objects that have no implicit conversion to QJsonValue. The current one can.
-rw-r--r-- | jobs/converters.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/jobs/converters.h b/jobs/converters.h index b52cfaa2..376dfeab 100644 --- a/jobs/converters.h +++ b/jobs/converters.h @@ -34,7 +34,8 @@ namespace QMatrixClient inline QJsonValue toJson(const QVector<T>& vals) { QJsonArray ar; - std::copy(vals.begin(), vals.end(), std::back_inserter(ar)); + for (const auto& v: vals) + ar.push_back(toJson(v)); return ar; } |