Logo Search packages:      
Sourcecode: qt4-x11 version File versions

template<typename T>
T * QVector< T >::data (  )  [inline]

Returns a pointer to the data stored in the vector. The pointer can be used to access and modify the items in the vector.

Example:

        QVector<int> vector(10);
        int *data = vector.data();
        for (int i = 0; i < 10; ++i)
            data[i] = 2 * i;

The pointer remains valid as long as the vector isn't reallocated.

This function is mostly useful to pass a vector to a function that accepts a plain C++ array.

See also:
constData(), operator[]()

Definition at line 95 of file qvector.h.

Referenced by QDir::cleanPath(), QPaintEngine::drawEllipse(), QMatrix::map(), QVector< T >::operator[](), QStack< T >::pop(), QVector< T >::replace(), QStack< T >::top(), and QString::toUcs4().

{ detach(); return d->array; }


Generated by  Doxygen 1.6.0   Back to index