⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qlinkedlist.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 3 页
字号:
    \typedef QLinkedList::difference_type    Typedef for ptrdiff_t. Provided for STL compatibility.*//*! \fn int QLinkedList::count() const    Same as size().*//*! \fn T& QLinkedList::first()    Returns a reference to the first item in the list. This function    assumes that the list isn't empty.    \sa last(), isEmpty()*//*! \fn const T& QLinkedList::first() const    \overload*//*! \fn T& QLinkedList::last()    Returns a reference to the last item in the list. This function    assumes that the list isn't empty.    \sa first(), isEmpty()*//*! \fn const T& QLinkedList::last() const    \overload*//*! \fn void QLinkedList::removeFirst()    Removes the first item in the list.    This is the same as erase(begin()).    \sa removeLast(), erase()*//*! \fn void QLinkedList::removeLast()    Removes the last item in the list.    \sa removeFirst(), erase()*//*! \fn T QLinkedList::takeFirst()    Removes the first item in the list and returns it.    If you don't use the return value, removeFirst() is more    efficient.    \sa takeLast(), removeFirst()*//*! \fn T QLinkedList::takeLast()    Removes the last item in the list and returns it.    If you don't use the return value, removeLast() is more    efficient.    \sa takeFirst(), removeLast()*//*! \fn void QLinkedList::push_back(const T &value)    This function is provided for STL compatibility. It is equivalent    to append(\a value).*//*! \fn void QLinkedList::push_front(const T &value)    This function is provided for STL compatibility. It is equivalent    to prepend(\a value).*//*! \fn T& QLinkedList::front()    This function is provided for STL compatibility. It is equivalent    to first().*//*! \fn const T& QLinkedList::front() const    \overload*//*! \fn T& QLinkedList::back()    This function is provided for STL compatibility. It is equivalent    to last().*//*! \fn const T& QLinkedList::back() const    \overload*//*! \fn void QLinkedList::pop_front()    This function is provided for STL compatibility. It is equivalent    to removeFirst().*//*! \fn void QLinkedList::pop_back()    This function is provided for STL compatibility. It is equivalent    to removeLast().*//*! \fn bool QLinkedList::empty() const    This function is provided for STL compatibility. It is equivalent    to isEmpty() and returns true if the list is empty.*//*! \fn QLinkedList<T> &QLinkedList::operator+=(const QLinkedList<T> &other)    Appends the items of the \a other list to this list and returns a    reference to this list.    \sa operator+(), append()*//*! \fn void QLinkedList::operator+=(const T &value)    \overload    Appends \a value to the list.*//*! \fn QLinkedList<T> QLinkedList::operator+(const QLinkedList<T> &other) const    Returns a list that contains all the items in this list followed    by all the items in the \a other list.    \sa operator+=()*//*! \fn QLinkedList<T> &QLinkedList::operator<<(const QLinkedList<T> &other)    Appends the items of the \a other list to this list and returns a    reference to this list.    \sa operator+=(), append()*//*! \fn QLinkedList<T> &QLinkedList::operator<<(const T &value)    \overload    Appends \a value to the list.*//*! \class QLinkedList::iterator    \brief The QLinkedList::iterator class provides an STL-style non-const iterator for QLinkedList.    QLinkedList features both \l{STL-style iterators} and    \l{Java-style iterators}. The STL-style iterators are more    low-level and more cumbersome to use; on the other hand, they are    slightly faster and, for developers who already know STL, have    the advantage of familiarity.    QLinkedList\<T\>::iterator allows you to iterate over a    QLinkedList\<T\> and to modify the list item associated with the    iterator. If you want to iterate over a const QLinkedList, use    QLinkedList::const_iterator instead. It is generally good    practice to use QLinkedList::const_iterator on a non-const    QLinkedList as well, unless you need to change the QLinkedList    through the iterator. Const iterators are slightly faster, and    can improve code readability.    The default QLinkedList::iterator constructor creates an    uninitialized iterator. You must initialize it using a    function like QLinkedList::begin(), QLinkedList::end(), or    QLinkedList::insert() before you can start iterating. Here's a    typical loop that prints all the items stored in a list:    \code        QLinkedList<QString> list;        list.append("January");        list.append("February");        ...        list.append("December");        QLinkedList<QString>::iterator i;        for (i = list.begin(); i != list.end(); ++i)            cout << *i << endl;    \endcode    STL-style iterators can be used as arguments to \l{generic    algorithms}. For example, here's how to find an item in the list    using the qFind() algorithm:    \code        QLinkedList<QString> list;        ...        QLinkedList<QString>::iterator it = qFind(list.begin(),                                                  list.end(), "Joel");        if (it != list.end())            cout << "Found Joel" << endl;    \endcode    Let's see a few examples of things we can do with a    QLinkedList::iterator that we cannot do with a QLinkedList::const_iterator.    Here's an example that increments every value stored in a    QLinkedList\<int\> by 2:    \code        QLinkedList<int>::iterator i;        for (i = list.begin(); i != list.end(); ++i)            *i += 2;    \endcode    Here's an example that removes all the items that start with an    underscore character in a QLinkedList\<QString\>:    \code        QLinkedList<QString> list;        ...        QLinkedList<QString>::iterator i = list.begin();        while (i != list.end()) {            if ((*i).startsWith("_"))                i = list.erase(i);            else                ++i;        }    \endcode    The call to QLinkedList::erase() removes the item pointed to by    the iterator from the list, and returns an iterator to the next    item. Here's another way of removing an item while iterating:    \code        QLinkedList<QString>::iterator i = list.begin();        while (i != list.end()) {            QLinkedList<QString>::iterator previous = i;            ++i;            if ((*previous).startsWith("_"))                list.erase(previous);        }    \endcode    It might be tempting to write code like this:    \code        // WRONG        while (i != list.end()) {            if ((*i).startsWith("_"))                list.erase(i);            ++i;        }    \endcode    However, this will potentially crash in \c{++i}, because \c i is    a dangling iterator after the call to erase().    Multiple iterators can be used on the same list. If you add items    to the list, existing iterators will remain valid. If you remove    items from the list, iterators that point to the removed items    will become dangling iterators.    \sa QLinkedList::const_iterator, QMutableLinkedListIterator*//*! \fn QLinkedList::iterator::iterator()    Constructs an uninitialized iterator.    Functions like operator*() and operator++() should not be called    on an uninitialized iterartor. Use operator=() to assign a value    to it before using it.    \sa QLinkedList::begin() QLinkedList::end()*//*! \fn QLinkedList::iterator::iterator(Node *node)    \internal*//*! \typedef QLinkedList::iterator::iterator_category    \internal*//*! \typedef QLinkedList::iterator::difference_type    \internal*//*! \typedef QLinkedList::iterator::value_type    \internal*//*! \typedef QLinkedList::iterator::pointer    \internal*//*! \typedef QLinkedList::iterator::reference    \internal*//*! \fn QLinkedList::iterator::iterator(const iterator &other)    Constructs a copy of \a other.*//*! \fn QLinkedList::iterator &QLinkedList::iterator::operator=(const iterator &other)    Assigns \a other to this iterator.*//*! \fn T &QLinkedList::iterator::operator*() const    Returns a modifiable reference to the current item.    You can change the value of an item by using operator*() on the    left side of an assignment, for example:    \code        if (*it == "Hello")            *it = "Bonjour";    \endcode    \sa operator->()*//*! \fn T *QLinkedList::iterator::operator->() const    Returns a pointer to the current item.    \sa operator*()*//*!    \fn bool QLinkedList::iterator::operator==(const iterator &other) const    \fn bool QLinkedList::iterator::operator==(const const_iterator &other) const    Returns true if \a other points to the same item as this    iterator; otherwise returns false.    \sa operator!=()*//*!    \fn bool QLinkedList::iterator::operator!=(const iterator &other) const    \fn bool QLinkedList::iterator::operator!=(const const_iterator &other) const    Returns true if \a other points to a different item than this    iterator; otherwise returns false.    \sa operator==()*//*! \fn QLinkedList::iterator &QLinkedList::iterator::operator++()    The prefix ++ operator (\c{++it}) advances the iterator to the    next item in the list and returns an iterator to the new current    item.    Calling this function on QLinkedList::end() leads to undefined    results.    \sa operator--()*//*! \fn QLinkedList::iterator QLinkedList::iterator::operator++(int)    \overload    The postfix ++ operator (\c{it++}) advances the iterator to the    next item in the list and returns an iterator to the previously    current item.*//*! \fn QLinkedList::iterator &QLinkedList::iterator::operator--()    The prefix -- operator (\c{--it}) makes the preceding item    current and returns an iterator to the new current item.    Calling this function on QLinkedList::begin() leads to undefined    results.    \sa operator++()*//*! \fn QLinkedList::iterator QLinkedList::iterator::operator--(int)    \overload    The postfix -- operator (\c{it--}) makes the preceding item    current and returns an iterator to the previously current item.*//*! \fn QLinkedList::iterator QLinkedList::iterator::operator+(int j) const

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -