There is a structure of the form:
struct MyStruct { qint32 field1; qint32 field2; QVector<qint16> field3; }; After using the object of this structure, you need to clear the QVector. How can this be done? Now only this solution comes to mind: declare the clear () method inside the structure, which will reset the structure fields and call the appropriate method to clear the vector:
struct MyStruct { qint32 field1; qint32 field2; QVector<qint16> field3; void clear() { field1 = 0; field2 = 0; field3.clear(); } };