if (asize == d->size) 
                  
                  
                          return detach(); 
                  
                  
                      if (asize > int(d->alloc) || !isDetached()) { // there is not enough space 
                  
                  
                          QArrayData::AllocationOptions opt = asize > int(d->alloc) ? QArrayData::Grow : QArrayData::Default; 
                  
                  
                          realloc(qMax(int(d->alloc), asize), opt); 
                  
                  
                      } 
                  
                  
                      if (asize < d->size) 
                  
                  
                          destruct(begin() + asize, end()); 
                  
                  
                      else 
                  
                  
                          defaultConstruct(end(), begin() + asize); 
                  
                  
                      d->size = asize; 
                  
                  
                  }
                  
                  
                
defaultConstruct() уже посмотрел?)
Ага void QVector<T>::defaultConstruct(T *from, T *to) { if (QTypeInfo<T>::isComplex) { while (from != to) { new (from++) T(); } } else { ::memset(static_cast<void *>(from), 0, (to - from) * sizeof(T)); } }
Обсуждают сегодня