c++ - How do you define a QHash with heterogeneous value types? -
i need have qhash container takes quint8 keys takes heterogeneous types values, of qt containers or classes. example might want insert qdate or qtime object or quint8 value.
how can define type can use in other classes , fill appropriately @ run time? want able access global type. possible?
n.b. question has been edited better reflect op's intent. answers written before edit appropriate original question.
qvariant type can store of wide range of value types, determined @ runtime, qhash<quint8, qvariant> want.
see https://en.wikipedia.org/wiki/tagged_union general pattern.
Comments
Post a Comment