Массив занимает меньше места, QVector содержит этот массив + дополнительные данные - посмотри в заголовок:
| Код | template <typename T> struct QVectorTypedData { QBasicAtomicInt ref; int alloc; int size; #if defined(QT_ARCH_SPARC) && defined(Q_CC_GNU) && defined(__LP64__) && defined(QT_BOOTSTRAPPED) // workaround for bug in gcc 3.4.2 uint sharable; uint capacity; #else uint sharable : 1; uint capacity : 1; #endif T array[1]; // Здесь хранится сам массив, памяти выделено на alloc >= size элементов };
template <typename T> class QVector { typedef QVectorTypedData<T> Data; union { QVectorData *p; QVectorTypedData<T> *d; }; ... };
|
|