Solved Serialization for QVector<QPair<size_t, double>>
-
Why isnt it possible to serialize a QVector<QPair<size_t, double>> with QDatastream? I mean i use allowed Datatypes https://doc.qt.io/qt-5/datastreamformat.html .
Do i need an additional Implementation for that?
I get this
image url) -
I tried with the below and it works perfectly. Make sure you have all the relevant includes at the top of your file
#include <QVector> #include <QDataStream> #include <QPair> #include <QByteArray> int main() { QByteArray temp; QVector<QPair<size_t,double> > vect{{5u,2.5},{7u,3.3}}; QDataStream stream(&temp,QIODevice::WriteOnly); stream << vect; return 0; }
-
Oh God i forgot to include QDatastream... thats so emberassing. Solved.