亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? qlistdata.cpp

?? QT 開發(fā)環(huán)境里面一個很重要的文件
?? CPP
?? 第 1 頁 / 共 4 頁
字號:
/******************************************************************************** Copyright (C) 1992-2006 Trolltech ASA. All rights reserved.**** This file is part of the QtCore module of the Qt Toolkit.**** This file may be used under the terms of the GNU General Public** License version 2.0 as published by the Free Software Foundation** and appearing in the file LICENSE.GPL included in the packaging of** this file.  Please review the following information to ensure GNU** General Public Licensing requirements will be met:** http://www.trolltech.com/products/qt/opensource.html**** If you are unsure which license is appropriate for your use, please** review the following information:** http://www.trolltech.com/products/qt/licensing.html or contact the** sales department at sales@trolltech.com.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#include "qlist.h"#include "qtools_p.h"#include <string.h>/*    QList as an array-list combines the easy-of-use of a random    access interface with fast list operations and the low memory    management overhead of an array. Accessing elements by index,    appending, prepending, and removing elements from both the front    and the back all happen in constant time O(1). Inserting or    removing elements at random index positions \ai happens in linear    time, or more precisly in O(min{i,n-i}) <= O(n/2), with n being    the number of elements in the list.*/QListData::Data QListData::shared_null = { Q_ATOMIC_INIT(1), 0, 0, 0, true, { 0 } };static int grow(int size){    // dear compiler: don't optimize me out.    volatile int x = qAllocMore(size * sizeof(void *), QListData::DataHeaderSize) / sizeof(void *);    return x;}QListData::Data *QListData::detach(){    Q_ASSERT(d->ref != 1);    Data *x = static_cast<Data *>(qMalloc(DataHeaderSize + d->alloc * sizeof(void *)));    ::memcpy(x, d, DataHeaderSize + d->alloc * sizeof(void *));    x->alloc = d->alloc;    x->ref.init(1);    x->sharable = true;    if (!x->alloc)        x->begin = x->end = 0;    x = qAtomicSetPtr(&d, x);    if (!x->ref.deref())        return x;    return 0;}void QListData::realloc(int alloc){    Q_ASSERT(d->ref == 1);    d = static_cast<Data *>(qRealloc(d, DataHeaderSize + alloc * sizeof(void *)));    d->alloc = alloc;    if (!alloc)        d->begin = d->end = 0;}void **QListData::append(){    Q_ASSERT(d->ref == 1);    if (d->end == d->alloc) {        int n = d->end - d->begin;        if (d->begin > 2 * d->alloc / 3) {            ::memcpy(d->array + n, d->array + d->begin, n * sizeof(void *));            d->begin = n;            d->end = n * 2;        } else {            realloc(grow(d->alloc + 1));        }    }    return d->array + d->end++;}void **QListData::append(const QListData& l){    Q_ASSERT(d->ref == 1);    int e = d->end;    int n = l.d->end - l.d->begin;    if (n) {        if (e + n > d->alloc)            realloc(grow(e + l.d->end - l.d->begin));        ::memcpy(d->array + d->end, l.d->array + l.d->begin, n * sizeof(void*));        d->end += n;    }    return d->array + e;}void **QListData::prepend(){    Q_ASSERT(d->ref == 1);    if (d->begin == 0) {        if (d->end >= d->alloc / 3)            realloc(grow(d->alloc + 1));        if (d->end < d->alloc / 3)            d->begin = d->alloc - 2 * d->end;        else            d->begin = d->alloc - d->end;        ::memmove(d->array + d->begin, d->array, d->end * sizeof(void *));        d->end += d->begin;    }    return d->array + --d->begin;}void **QListData::insert(int i){    Q_ASSERT(d->ref == 1);    if (i <= 0)        return prepend();    if (i >= d->end - d->begin)        return append();    bool leftward = false;    int size = d->end - d->begin;    if (d->begin == 0) {        if (d->end == d->alloc) {            // If the array is full, we expand it and move some items rightward            realloc(grow(d->alloc + 1));        } else {            // If there is free space at the end of the array, we move some items rightward        }    } else {        if (d->end == d->alloc) {            // If there is free space at the beginning of the array, we move some items leftward            leftward = true;        } else {            // If there is free space at both ends, we move as few items as possible            leftward = (i < size - i);        }    }    if (leftward) {        --d->begin;        ::memmove(d->array + d->begin, d->array + d->begin + 1, i * sizeof(void *));    } else {        ::memmove(d->array + d->begin + i + 1, d->array + d->begin + i,                  (size - i) * sizeof(void *));        ++d->end;    }    return d->array + d->begin + i;}void QListData::remove(int i){    Q_ASSERT(d->ref == 1);    i += d->begin;    if (i - d->begin < d->end - i) {        if (int offset = i - d->begin)            ::memmove(d->array + d->begin + 1, d->array + d->begin, offset * sizeof(void *));        d->begin++;    } else {        if (int offset = d->end - i - 1)            ::memmove(d->array + i, d->array + i + 1, offset * sizeof(void *));        d->end--;    }}void QListData::remove(int i, int n){    Q_ASSERT(d->ref == 1);    i += d->begin;    int middle = i + n/2;    if (middle - d->begin < d->end - middle) {        ::memmove(d->array + d->begin + n, d->array + d->begin,                   (i - d->begin) * sizeof(void*));        d->begin += n;    } else {        ::memmove(d->array + i, d->array + i + n,                   (d->end - i - n) * sizeof(void*));        d->end -= n;    }}void QListData::move(int from, int to){    Q_ASSERT(d->ref == 1);    if (from == to)        return;    from += d->begin;    to += d->begin;    void *t = d->array[from];    if (from < to) {        if (d->end == d->alloc || 3 * (to - from) < 2 * (d->end - d->begin)) {            ::memmove(d->array + from, d->array + from + 1, (to - from) * sizeof(void *));        } else {            // optimization            if (int offset = from - d->begin)                ::memmove(d->array + d->begin + 1, d->array + d->begin, offset * sizeof(void *));            if (int offset = d->end - (to + 1))                ::memmove(d->array + to + 2, d->array + to + 1, offset * sizeof(void *));            ++d->begin;            ++d->end;            ++to;        }    } else {        if (d->begin == 0 || 3 * (from - to) < 2 * (d->end - d->begin)) {            ::memmove(d->array + to + 1, d->array + to, (from - to) * sizeof(void *));        } else {            // optimization            if (int offset = to - d->begin)                ::memmove(d->array + d->begin - 1, d->array + d->begin, offset * sizeof(void *));            if (int offset = d->end - (from + 1))                ::memmove(d->array + from, d->array + from + 1, offset * sizeof(void *));            --d->begin;            --d->end;            --to;        }    }    d->array[to] = t;}void **QListData::erase(void **xi){    Q_ASSERT(d->ref == 1);    int i = xi - (d->array + d->begin);    remove(i);    return d->array + d->begin + i;}/*! \class QList    \brief The QList class is a template class that provides lists.    \ingroup tools    \ingroup shared    \mainclass    \reentrant    QList\<T\> is one of Qt's generic \l{container classes}. It    stores a list of values and provides fast index-based access as    well as fast insertions and removals.    QList\<T\>, QLinkedList\<T\>, and QVector\<T\> provide similar    functionality. Here's an overview:    \list    \i For most purposes, QList is the right class to use. Its       index-based API is more convenient than QLinkedList's       iterator-based API, and it is usually faster than       QVector because of the way it stores its items in       memory. It also expands to less code in your executable.    \i If you need a real linked list, with guarantees of \l{constant       time} insertions in the middle of the list and iterators to       items rather than indexes, use QLinkedList.    \i If you want the items to occupy adjacent memory positions,       use QVector.    \endlist    Internally, QList\<T\> is represented as an array of pointers to    items. (Exceptionally, if T is a pointer type, a basic type of    the size of a pointer, or one of Qt's \l{shared classes},    QList\<T\> stores the item directly in the pointer.) For lists    under a thousand items, this representation allows for very fast    insertions in the middle, in addition to instantaneous    index-based access. Furthermore, operations like prepend() and    append() are very fast, because QList preallocates memory on both    sides of its internal array. (See \l{Algorithmic Complexity}    for details.)    Here's an example of a QList that stores integers and    a QList that stores QDate values:    \code        QList<int> integerList;        QList<QDate> dateList;    \endcode    Qt includes a QStringList class that inherits QList\<QString\>    and adds a few convenience functions, such as QStringList::join()    and QStringList::find(). (QString::split() creates QStringLists    from strings.)    QList stores a list of items. The default constructor creates an    empty list. To insert items into the list, you can use    operator<<():    \code        QList<QString> list;        list << "one" << "two" << "three";        // list: ["one", "two", "three"]    \endcode    QList provides these basic functions to add, move, and remove    items: insert(), replace(), removeAt(), move(), and swap(). In    addition, it provides the following convenience functions:    append(), prepend(), removeFirst(), and removeLast().    QList uses 0-based indexes, just like C++ arrays. To access the    item at a particular index position, you can use operator[](). On    non-const lists, operator[]() returns a reference to the item and    can be used on the left side of an assignment:    \code        if (list[0] == "Bob")            list[0] = "Robert";    \endcode    Because QList is implemented as an array of pointers, this    operation is very fast (\l{constant time}). For read-only access,    an alternative syntax is to use at():    \code        for (int i = 0; i < list.size(); ++i) {            if (list.at(i) == "Jane")                cout << "Found Jane at position " << i << endl;        }    \endcode    at() can be faster than operator[](), because it never causes a    \l{deep copy} to occur.    A common requirement is to remove an item from a list and do    something with it. For this, QList provides takeAt(), takeFirst(),    and takeLast(). Here's a loop that removes the items from a list    one at a time and calls \c delete on them:    \code        QList<QWidget *> list;        ...        while (!list.isEmpty())            delete list.takeFirst();    \endcode    Inserting and removing items at either ends of the list is very    fast (\l{constant time} in most cases), because QList    preallocates extra space on both sides of its internal buffer to    allow for fast growth at both ends of the list.    If you want to find all occurrences of a particular value in a    list, use indexOf() or lastIndexOf(). The former searches forward    starting from a given index position, the latter searches    backward. Both return the index of a matching item if they find    it; otherwise, they return -1. For example:    \code        int i = list.indexOf("Jane");        if (i != -1)            cout << "First occurrence of Jane is at position " << i << endl;    \endcode    If you simply want to check whether a list contains a particular    value, use contains(). If you want to find out how many times a    particular value occurs in the list, use count(). If you want to    replace all occurrences of a particular value with another, use    replace().    QList's value type must be an \l{assignable data type}. This    covers most data types that are commonly used, but the compiler    won't let you, for example, store a QWidget as a value; instead,    store a QWidget *. A few functions have additional requirements;    for example, indexOf() and lastIndexOf() expect the value type to    support \c operator==(). These requirements are documented on a    per-function basis.    Like the other container classes, QList provides \l{Java-style    iterators} (QListIterator and QMutableListIterator) and    \l{STL-style iterators} (QList::const_iterator and    QList::iterator). In practice, these are rarely used, because    you can use indexes into the QList. QList is implemented in such    a way that direct index-based access is just as fast as using    iterators.    QList does \e not support inserting, prepending, appending or replacing    with references to its own values. Doing so will cause your application to    abort with an error message.    \sa QListIterator, QMutableListIterator, QLinkedList, QVector*//*!    \fn QList<T> QList<T>::mid(int pos, int length) const    Returns a list whose elements are copied from this list,    starting at position \a pos. If \a length is -1 (the default), all    elements after \a pos are copied; otherwise \a length elements (or    all remaining elements if there are less than \a length elements)    are copied.*//*! \fn QList::QList()    Constructs an empty list.*//*! \fn QList::QList(const QList<T> &other)    Constructs a copy of \a other.    This operation takes \l{constant time}, because QList is    \l{implicitly shared}. This makes returning a QList from a    function very fast. If a shared instance is modified, it will be    copied (copy-on-write), and that takes \l{linear time}.    \sa operator=()*//*! \fn QList::~QList()    Destroys the list. References to the values in the list and all    iterators of this list become invalid.*//*! \fn QList<T> &QList::operator=(const QList<T> &other)    Assigns \a other to this list and returns a reference to this    list.*//*! \fn bool QList::operator==(const QList<T> &other) const    Returns true if \a other is equal to this list; otherwise returns    false.    Two lists are considered equal if they contain the same values in    the same order.    This function requires the value type to have an implementation of    \c operator==().

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久99这里只有精品| 欧美www视频| 国产精品国产三级国产普通话99| 蜜桃av一区二区三区| 91精品国产麻豆| 韩国一区二区三区| 中文字幕精品一区二区三区精品| 丁香天五香天堂综合| 亚洲视频资源在线| 欧洲精品一区二区三区在线观看| 亚洲综合小说图片| 91精品国产全国免费观看| 精品一区二区三区av| 国产精品理论片在线观看| 91浏览器打开| 国模冰冰炮一区二区| 亚洲日本va在线观看| 欧美高清一级片在线| 高清视频一区二区| 丝袜美腿亚洲一区二区图片| 欧美精品一区二区三区蜜桃视频 | 日韩精品资源二区在线| 成人av午夜电影| 久久成人精品无人区| 亚洲成人先锋电影| 精品捆绑美女sm三区| 国产.欧美.日韩| 一区二区不卡在线播放 | 日韩一级欧美一级| 毛片av中文字幕一区二区| 捆绑紧缚一区二区三区视频 | 色综合 综合色| 久久综合九色综合欧美就去吻| 亚洲视频中文字幕| 国产午夜精品美女毛片视频| 久久精品一区二区三区不卡牛牛 | 色婷婷久久久久swag精品 | 国产丝袜在线精品| 国产精品久久午夜| 成人av网站大全| 日韩成人一区二区三区在线观看| 91丨porny丨中文| 日韩成人午夜电影| 欧美三级电影精品| 日韩美女视频一区二区 | 在线观看日韩毛片| 99国产精品久| 91视视频在线直接观看在线看网页在线看| 紧缚奴在线一区二区三区| 麻豆一区二区三区| 国产福利91精品一区二区三区| 国产精品91xxx| 麻豆91免费看| 国模冰冰炮一区二区| 成人av一区二区三区| 不卡的av中国片| 欧美三级电影一区| 日韩亚洲欧美成人一区| 久久九九影视网| 亚洲图片激情小说| 视频一区欧美日韩| 精品影视av免费| 成人一级视频在线观看| 色婷婷久久久久swag精品| 欧美日韩国产综合视频在线观看| 欧美一级片在线看| 国产精品美女一区二区三区| 亚洲午夜影视影院在线观看| 麻豆高清免费国产一区| 91久久精品国产91性色tv| 欧美mv日韩mv亚洲| 国产三级欧美三级日产三级99| 久久久午夜精品理论片中文字幕| 国产精品国产三级国产普通话蜜臀 | 亚洲妇熟xx妇色黄| 风间由美一区二区三区在线观看| 97久久精品人人爽人人爽蜜臀| 国产一区二区免费在线| 91官网在线观看| 国产欧美综合色| 经典三级一区二区| 日韩一级完整毛片| 亚洲国产va精品久久久不卡综合| 成人不卡免费av| 日本一区二区三区国色天香| 日本美女一区二区| 精品视频一区三区九区| 欧美午夜免费电影| 国产精品成人在线观看| 国产精品亚洲第一区在线暖暖韩国| 宅男噜噜噜66一区二区66| 亚洲一区二区影院| 欧美欧美午夜aⅴ在线观看| 亚洲精品高清视频在线观看| 日本精品视频一区二区三区| 中文字幕亚洲欧美在线不卡| 久久99蜜桃精品| 99热精品国产| 国产精品久线观看视频| 99精品热视频| 亚洲国产综合色| 91精品国产综合久久精品性色| 亚洲成av人片一区二区三区| 在线观看一区日韩| 蜜臀av性久久久久蜜臀aⅴ| 日韩精品一区二区在线观看| 国产精品一品视频| 亚洲国产精品99久久久久久久久 | 国产精品网站在线| 色呦呦日韩精品| 日本欧美一区二区在线观看| 2020日本不卡一区二区视频| 99久久免费精品| 免费成人在线视频观看| 欧美激情一区二区三区不卡| 欧美色综合网站| 奇米综合一区二区三区精品视频| 91麻豆精品国产91久久久资源速度 | 国产成人无遮挡在线视频| 亚洲精品免费看| 亚洲精品久久久蜜桃| 欧美成人国产一区二区| 色婷婷久久综合| 国产成人8x视频一区二区| 欧美一级日韩一级| 菠萝蜜视频在线观看一区| 亚洲国产精品一区二区久久恐怖片 | www久久精品| 欧洲一区在线观看| 国产suv一区二区三区88区| 免费成人深夜小野草| 五月天激情综合网| 亚洲欧美视频在线观看视频| 日韩一区二区三区高清免费看看| 不卡av免费在线观看| 精品综合免费视频观看| 日韩国产欧美在线视频| 丝袜美腿亚洲一区二区图片| 亚洲综合在线视频| 夜夜揉揉日日人人青青一国产精品| 中文在线一区二区| 国产亚洲精品中文字幕| 国产欧美一区二区三区沐欲 | 久久精品国产精品亚洲红杏| 亚洲成人在线网站| 亚洲一本大道在线| 日日夜夜免费精品视频| 爽好多水快深点欧美视频| 日韩精品乱码免费| 天天综合色天天| 狠狠狠色丁香婷婷综合久久五月| 日本欧美加勒比视频| 国内精品在线播放| 成人动漫一区二区| 91小视频在线免费看| 91美女片黄在线观看| 欧美性生活久久| 欧美大片一区二区三区| 国产精品私人影院| 五月天精品一区二区三区| 91成人免费在线| 日韩精品一区国产麻豆| 国产精品福利一区二区三区| 亚洲第一会所有码转帖| 国内不卡的二区三区中文字幕 | 欧美va天堂va视频va在线| 亚洲国产高清不卡| 日韩电影在线观看电影| 丁香婷婷综合激情五月色| 欧美日韩一区在线观看| 久久久99精品久久| 亚洲1区2区3区视频| 麻豆久久一区二区| 国产麻豆一精品一av一免费| 色综合久久99| 精品福利一区二区三区免费视频| 日韩美女视频一区二区 | 日本欧美大码aⅴ在线播放| 粉嫩aⅴ一区二区三区四区| 欧美福利视频一区| 亚洲精品一二三| 国产精品99久久久久久久vr| 日韩一区二区三区av| 亚洲成a人片在线观看中文| 裸体一区二区三区| 在线观看网站黄不卡| 1024成人网| 不卡在线视频中文字幕| 精品国产123| 国产美女精品在线| 精品国产髙清在线看国产毛片| 国产精品2024| 国产日韩精品视频一区| 国产成+人+日韩+欧美+亚洲| 精品国产区一区| 国产精品亚洲第一区在线暖暖韩国| 欧美精品一区二区三区蜜桃| 午夜视频在线观看一区二区 | 轻轻草成人在线| 欧美电影精品一区二区|