?? qvector.cpp
字號:
\overload Inserts \a count copies of \a value at index position \a i in the vector. Example: \code QVector<double> vector; vector << 2.718 << 1.442 << 0.4342; vector.insert(1, 3, 9.9); // vector: [2.718, 9.9, 9.9, 9.9, 1.442, 0.4342] \endcode*//*! \fn QVector::iterator QVector::insert(iterator before, const T &value) \overload Inserts \a value in front of the item pointed to by the iterator \a before. Returns an iterator pointing at the inserted item.*//*! \fn QVector::iterator QVector::insert(iterator before, int count, const T &value) Inserts \a count copies of \a value in front of the item pointed to by the iterator \a before. Returns an iterator pointing at the first of the inserted items.*//*! \fn void QVector::replace(int i, const T &value) Replaces the item at index position \a i with \a value. \a i must be a valid index position in the vector (i.e., 0 <= \a i < size()). \sa operator[](), remove()*//*! \fn void QVector::remove(int i) \overload Removes the element at index position \a i. \sa insert(), replace(), fill()*//*! \fn void QVector::remove(int i, int count) \overload Removes \a count elements from the middle of the vector, starting at index position \a i. \sa insert(), replace(), fill()*//*! \fn QVector &QVector::fill(const T &value, int size = -1) Assigns \a value to all items in the vector. If \a size is different from -1 (the default), the vector is resized to size \a size beforehand. Example: \code QVector<QString> vector(3); vector.fill("Yes"); // vector: ["Yes", "Yes", "Yes"] vector.fill("oh", 5); // vector: ["oh", "oh", "oh", "oh", "oh"] \endcode \sa resize()*//*! \fn int QVector::indexOf(const T &value, int from = 0) const Returns the index position of the first occurrence of \a value in the vector, searching forward from index position \a from. Returns -1 if no item matched. Example: \code QVector<QString> vector; vector << "A" << "B" << "C" << "B" << "A"; vector.indexOf("B"); // returns 1 vector.indexOf("B", 1); // returns 1 vector.indexOf("B", 2); // returns 3 vector.indexOf("X"); // returns -1 \endcode This function requires the value type to have an implementation of \c operator==(). \sa lastIndexOf(), contains()*//*! \fn int QVector::lastIndexOf(const T &value, int from = -1) const Returns the index position of the last occurrence of the value \a value in the vector, searching backward from index position \a from. If \a from is -1 (the default), the search starts at the last item. Returns -1 if no item matched. Example: \code QList<QString> vector; vector << "A" << "B" << "C" << "B" << "A"; vector.lastIndexOf("B"); // returns 3 vector.lastIndexOf("B", 3); // returns 3 vector.lastIndexOf("B", 2); // returns 1 vector.lastIndexOf("X"); // returns -1 \endcode This function requires the value type to have an implementation of \c operator==(). \sa indexOf()*//*! \fn bool QVector::contains(const T &value) const Returns true if the vector contains an occurrence of \a value; otherwise returns false. This function requires the value type to have an implementation of \c operator==(). \sa indexOf(), count()*//*! \fn int QVector::count(const T &value) const Returns the number of occurrences of \a value in the vector. This function requires the value type to have an implementation of \c operator==(). \sa contains(), indexOf()*//*! \fn int QVector::count() const \overload Same as size().*//*! \fn QVector::iterator QVector::begin() Returns an \l{STL-style iterator} pointing to the first item in the vector. \sa constBegin(), end()*//*! \fn QVector::const_iterator QVector::begin() const \overload*//*! \fn QVector::const_iterator QVector::constBegin() const Returns a const \l{STL-style iterator} pointing to the first item in the vector. \sa begin(), constEnd()*//*! \fn QVector::iterator QVector::end() Returns an \l{STL-style iterator} pointing to the imaginary item after the last item in the vector. \sa begin(), constEnd()*//*! \fn QVector::const_iterator QVector::end() const \overload*//*! \fn QVector::const_iterator QVector::constEnd() const Returns a const \l{STL-style iterator} pointing to the imaginary item after the last item in the vector. \sa constBegin(), end()*//*! \fn QVector::iterator QVector::erase(iterator pos) Removes the item pointed to by the iterator \a pos from the vector, and returns an iterator to the next item in the vector (which may be end()). \sa insert(), remove()*//*! \fn QVector::iterator QVector::erase(iterator begin, iterator end) \overload Removes all the items from \a begin up to (but not including) \a end. Returns an iterator to the same item that \a end referred to before the call.*//*! \fn T& QVector::first() Returns a reference to the first item in the vector. This function assumes that the vector isn't empty. \sa last(), isEmpty()*//*! \fn const T& QVector::first() const \overload*//*! \fn T& QVector::last() Returns a reference to the last item in the vector. This function assumes that the vector isn't empty. \sa first(), isEmpty()*//*! \fn const T& QVector::last() const \overload*//*! \fn T QVector::value(int i) const Returns the value at index position \a i in the vector. If the index \a i is out of bounds, the function returns a \l{default-constructed value}. If you are certain that \a i is within bounds, you can use at() instead, which is slightly faster. \sa at(), operator[]()*//*! \fn T QVector::value(int i, const T &defaultValue) const \overload If the index \a i is out of bounds, the function returns \a defaultValue.*//*! \fn void QVector::push_back(const T &value) This function is provided for STL compatibility. It is equivalent to append(\a value).*//*! \fn void QVector::push_front(const T &value) This function is provided for STL compatibility. It is equivalent to prepend(\a value).*//*! \fn void QVector::pop_front() This function is provided for STL compatibility. It is equivalent to erase(begin()).*//*! \fn void QVector::pop_back() This function is provided for STL compatibility. It is equivalent to erase(end() - 1).*//*! \fn T& QVector::front() This function is provided for STL compatibility. It is equivalent to first().*//*! \fn QVector::const_reference QVector::front() const \overload*//*! \fn QVector::reference QVector::back() This function is provided for STL compatibility. It is equivalent to last().*//*! \fn QVector::const_reference QVector::back() const \overload*//*! \fn bool QVector::empty() const This function is provided for STL compatibility. It is equivalent to isEmpty(), returning true if the vector is empty; otherwise returns false.*//*! \fn QVector<T> &QVector::operator+=(const QVector<T> &other) Appends the items of the \a other vector to this vector and returns a reference to this vector. \sa operator+(), append()*//*! \fn void QVector::operator+=(const T &value) \overload Appends \a value to the vector. \sa append(), operator<<()*//*! \fn QVector<T> QVector::operator+(const QVector<T> &other) const Returns a vector that contains all the items in this vector followed by all the items in the \a other vector. \sa operator+=()*//*! \fn QVector<T> &QVector::operator<<(const T &value) Appends \a value to the vector and returns a reference to this vector. \sa append(), operator+=()*//*! \fn QVector<T> &QVector::operator<<(const QVector<T> &other) Appends \a other to the vector and returns a reference to the vector.*//*! \typedef QVector::iterator The QVector::iterator typedef provides an STL-style non-const iterator for QVector and QStack. QVector provides both \l{STL-style iterators} and \l{Java-style iterators}. The STL-style non-const iterator is simply a typedef for "T *" (pointer to T). \sa QVector::begin(), QVector::end(), QVector::const_iterator, QMutableVectorIterator*//*! \typedef QVector::const_iterator The QVector::const_iterator typedef provides an STL-style const iterator for QVector and QStack. QVector provides both \l{STL-style iterators} and \l{Java-style iterators}. The STL-style const iterator is simply a typedef for "const T *" (pointer to const T). \sa QVector::constBegin(), QVector::constEnd(), QVector::iterator, QVectorIterator*//*! \typedef QVector::Iterator Qt-style synonym for QVector::iterator.*//*! \typedef QVector::ConstIterator Qt-style synonym for QVector::const_iterator.*//*! \typedef QVector::const_pointer Typedef for const T *. Provided for STL compatibility.*//*! \typedef QVector::const_reference Typedef for T &. Provided for STL compatibility.*//*! \typedef QVector::difference_type Typedef for ptrdiff_t. Provided for STL compatibility.*//*! \typedef QVector::pointer Typedef for T *. Provided for STL compatibility.*//*! \typedef QVector::reference Typedef for T &. Provided for STL compatibility.*//*! \typedef QVector::size_type Typedef for int. Provided for STL compatibility.*//*! \typedef QVector::value_type Typedef for T. Provided for STL compatibility.*//*! \fn QList<T> QVector<T>::toList() const Returns a QList object with the data contained in this QVector. Example: \code QVector<double> vect; vect << "red" << "green" << "blue" << "black"; QList<double> list = vect.toList(); // list: ["red", "green", "blue", "black"] \endcode \sa fromList(), QList::fromVector()*//*! \fn QVector<T> QVector<T>::fromList(const QList<T> &list) Returns a QVector object with the data contained in \a list. Example: \code QStringList list; list << "Sven" << "Kim" << "Ola"; QVector<QString> vect = QVector<QString>::fromList(list); // vect: ["Sven", "Kim", "Ola"] \endcode \sa toList(), QList::toVector()*//*! \fn QVector<T> QVector<T>::fromStdVector(const std::vector<T> &vector) Returns a QVector object with the data contained in \a vector. The order of the elements in the QVector is the same as in \a vector. Example: \code std::vector<double> stdvector; vector.push_back(1.2); vector.push_back(0.5); vector.push_back(3.14); QVector<double> vector = QVector<double>::fromStdVector(stdvector); \endcode \sa toStdVector(), QList::fromStdList()*//*! \fn std::vector<T> QVector<T>::toStdVector() const Returns a std::vector object with the data contained in this QVector. Example: \code QVector<double> vector; vector << 1.2 << 0.5 << 3.14; std::vector<double> stdvector = vector.toStdVector(); \endcode \sa fromStdVector(), QList::toStdList()*//*! \fn QDataStream &operator<<(QDataStream &out, const QVector<T> &vector) \relates QVector Writes the vector \a vector to stream \a out. This function requires the value type to implement \c operator<<(). \sa \link datastreamformat.html Format of the QDataStream operators \endlink*//*! \fn QDataStream &operator>>(QDataStream &in, QVector<T> &vector) \relates QVector Reads a vector from stream \a in into \a vector. This function requires the value type to implement \c operator>>(). \sa \link datastreamformat.html Format of the QDataStream operators \endlink*/
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -