Using QVector : QVector « Qt « C++






Using QVector

  

#include <QVector>
#include <QDebug>

int main()
{
  const int n = 10;
  QVector<int> vector(n);
  int * data = vector.data();
  for (int i = 0; i < n; ++i)
  data[i] = i;
  for (int i = 0; i < n; ++i) {
    data[i] * = 2;
    qDebug() << vector.at(i);
  }

  QVector<QString> strvector;
  strvector.append("s");
  if (strvector[0] == "s")
    strvector[0] = "868686876";
  qDebug() << strvector;
  return 0;
}

   
    
  








Related examples in the same category

1.Copying Container Areas
2.Store QPoint in QVector
3.creates two containers and compares all the elements for equality: