0
votes

I have a class MyVector : QVector<int>, for which I have an ID and a QVector of tags attached to it. When overloading operator>> for streaming from a QDataStream, I can simply chain the already-defined operator>>-functions for the ID and the tag vector. But how do I access the vector data itself for streaming? I cannot simply use istream >> myVector, because that's what I'm about to define, giving endless recursion. Thanks for your suggestions.

1

1 Answers

2
votes

You need to cast back your instance to the original QVector superclass in order to call the correct >> operator implementation.

istream >> static_cast<QVector<int>>(myVector)