[Qt-interest] QList<T> conversion

Gustavo de Sá Carvalho Honorato gustavohonorato at gmail.com
Tue Feb 1 15:02:57 CET 2011


On Tue, Feb 1, 2011 at 11:42 AM,  <Oliver.Knoll at comit.ch> wrote:
> On 2011-02-01 Gustavo Gustavo de Sá Carvalho Honorato wrote:
>
>>> ...
>>>    QList<A *> list;
>>>    QList<QObject *> objectList  *reinterpret_cast<QList<QObject
>>> *>*>(&list);
>>>
>>> The data structures in QList<T*> are isomorphic for all T.
>>
>> What you mean with isomorphic?
>
> Isomorphism is a very basic property of any OO-related language. It means that the list contains items of type T or derivatives thereof, or in other words: the list can contain *different* types (with the common base type T), and when you *assume* that *all* items are of type A (which inherit from T), well then, that just remains an assumption.
>

Oliver, what you described seems like polymorphism to me. Are you
saying that isomorphism and polymorphism are the same concept?

> This assumption might be valid in your specific case, but not in the general case, hence the disclaimer. Because your program would blow up the universe, if the list contained items of type A and B...
>
> Cheers, Oliver
> --
> Oliver Knoll
> Dipl. Informatik-Ing. ETH
> COMIT AG - ++41 79 520 95 22
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
>



More information about the Qt-interest-old mailing list