I want to know, How QVariant can internally stores, int, QMap, QList,...
I mean what is the internal data-structure/Implementation? What is the overhead of storing and retrieving types (int, float) in QVariant?
I want to know, How QVariant can internally stores, int, QMap, QList,...
I mean what is the internal data-structure/Implementation? What is the overhead of storing and retrieving types (int, float) in QVariant?
Copyright © 2021 Jogjafile Inc.
A quick look at the code reveals that a
QVariantis basically aunionof several primitive types (int,floatetc'), aQObjectpointer, and avoid*pointer for anything else that is not aQObjectand not a primitive. There is also a type data member that allows it to know what's actually currently stored there. The overhead appears to be not much more than storing to a member of a struct, checking that for type compatibility and possibly making a conversion (int to float for instance)