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

📄 qalgorithms.h

📁 奇趣公司比较新的qt/emd版本
💻 H
📖 第 1 页 / 共 2 页
字号:
/******************************************************************************** Copyright (C) 1992-2007 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://trolltech.com/products/qt/licenses/licensing/opensource/**** If you are unsure which license is appropriate for your use, please** review the following information:** http://trolltech.com/products/qt/licenses/licensing/licensingoverview** or contact the sales department at sales@trolltech.com.**** In addition, as a special exception, Trolltech gives you certain** additional rights. These rights are described in the Trolltech GPL** Exception version 1.0, which can be found at** http://www.trolltech.com/products/qt/gplexception/ and in the file** GPL_EXCEPTION.txt in this package.**** In addition, as a special exception, Trolltech, as the sole copyright** holder for Qt Designer, grants users of the Qt/Eclipse Integration** plug-in the right for the Qt/Eclipse Integration to link to** functionality provided by Qt Designer and its related libraries.**** Trolltech reserves all rights not expressly granted herein.**** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.******************************************************************************/#ifndef QALGORITHMS_H#define QALGORITHMS_H#include <QtCore/qglobal.h>QT_BEGIN_HEADERQT_MODULE(Core)/*    Warning: The contents of QAlgorithmsPrivate is not a part of the public Qt API    and may be changed from version to version or even be completely removed.*/namespace QAlgorithmsPrivate {template <typename RandomAccessIterator, typename T, typename LessThan>Q_OUTOFLINE_TEMPLATE void qSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan);template <typename RandomAccessIterator, typename T>inline void qSortHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &dummy);template <typename RandomAccessIterator, typename T, typename LessThan>Q_OUTOFLINE_TEMPLATE void qStableSortHelper(RandomAccessIterator start, RandomAccessIterator end, const T &t, LessThan lessThan);template <typename RandomAccessIterator, typename T>inline void qStableSortHelper(RandomAccessIterator, RandomAccessIterator, const T &);template <typename RandomAccessIterator, typename T, typename LessThan>Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan);template <typename RandomAccessIterator, typename T, typename LessThan>Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBoundHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan);template <typename RandomAccessIterator, typename T, typename LessThan>Q_OUTOFLINE_TEMPLATE RandomAccessIterator qBinaryFindHelper(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan);}template <typename InputIterator, typename OutputIterator>inline OutputIterator qCopy(InputIterator begin, InputIterator end, OutputIterator dest){    while (begin != end)        *dest++ = *begin++;    return dest;}template <typename BiIterator1, typename BiIterator2>inline BiIterator2 qCopyBackward(BiIterator1 begin, BiIterator1 end, BiIterator2 dest){    while (begin != end)        *--dest = *--end;    return dest;}template <typename InputIterator1, typename InputIterator2>inline bool qEqual(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2){    for (; first1 != last1; ++first1, ++first2)        if (!(*first1 == *first2))            return false;    return true;}template <typename ForwardIterator, typename T>inline void qFill(ForwardIterator first, ForwardIterator last, const T &val){    for (; first != last; ++first)        *first = val;}template <typename Container, typename T>inline void qFill(Container &container, const T &val){    qFill(container.begin(), container.end(), val);}template <typename InputIterator, typename T>inline InputIterator qFind(InputIterator first, InputIterator last, const T &val){    while (first != last && !(*first == val))        ++first;    return first;}template <typename Container, typename T>inline typename Container::const_iterator qFind(const Container &container, const T &val){    return qFind(container.constBegin(), container.constEnd(), val);}template <typename InputIterator, typename T, typename Size>inline void qCount(InputIterator first, InputIterator last, const T &value, Size &n){    for (; first != last; ++first)        if (*first == value)            ++n;}template <typename Container, typename T, typename Size>inline void qCount(const Container &container, const T &value, Size &n){    qCount(container.constBegin(), container.constEnd(), value, n);}#if defined Q_CC_MSVC && _MSC_VER < 1300template <typename T>inline void qSwap(T &value1, T &value2){    qSwap_helper<T>(value1, value2, (T *)0);}#elsetemplate <typename T>inline void qSwap(T &value1, T &value2){    T t = value1;    value1 = value2;    value2 = t;}#endif#ifdef qdoctemplate <typename T>LessThan qLess(){}template <typename T>LessThan qGreater(){}#elsetemplate <typename T>class qLess{public:    inline bool operator()(const T &t1, const T &t2) const    {        return (t1 < t2);    }};template <typename T>class qGreater{public:    inline bool operator()(const T &t1, const T &t2) const    {        return (t2 < t1);    }};#endiftemplate <typename RandomAccessIterator>inline void qSort(RandomAccessIterator start, RandomAccessIterator end){    if (start != end)        QAlgorithmsPrivate::qSortHelper(start, end, *start);}template <typename RandomAccessIterator, typename LessThan>inline void qSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan){    if (start != end)        QAlgorithmsPrivate::qSortHelper(start, end, *start, lessThan);}template<typename Container>inline void qSort(Container &c){#ifdef Q_CC_BOR    // Work around Borland 5.5 optimizer bug    c.detach();#endif    if (!c.empty())        QAlgorithmsPrivate::qSortHelper(c.begin(), c.end(), *c.begin());}template <typename RandomAccessIterator>inline void qStableSort(RandomAccessIterator start, RandomAccessIterator end){    if (start != end)        QAlgorithmsPrivate::qStableSortHelper(start, end, *start);}template <typename RandomAccessIterator, typename LessThan>inline void qStableSort(RandomAccessIterator start, RandomAccessIterator end, LessThan lessThan){    if (start != end)        QAlgorithmsPrivate::qStableSortHelper(start, end, *start, lessThan);}template<typename Container>inline void qStableSort(Container &c){#ifdef Q_CC_BOR    // Work around Borland 5.5 optimizer bug    c.detach();#endif    if (!c.empty())        QAlgorithmsPrivate::qStableSortHelper(c.begin(), c.end(), *c.begin());}template <typename RandomAccessIterator, typename T>Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value){    // Implementation is duplicated from QAlgorithmsPrivate to keep existing code    // compiling. We have to allow using *begin and value with different types,     // and then implementing operator< for those types.    RandomAccessIterator middle;    int n = end - begin;    int half;    while (n > 0) {        half = n >> 1;        middle = begin + half;        if (*middle < value) {            begin = middle + 1;            n -= half + 1;        } else {            n = half;        }    }    return begin;}template <typename RandomAccessIterator, typename T, typename LessThan>Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value, LessThan lessThan){    return QAlgorithmsPrivate::qLowerBoundHelper(begin, end, value, lessThan);}template <typename Container, typename T>Q_OUTOFLINE_TEMPLATE typename Container::const_iterator qLowerBound(const Container &container, const T &value){    return QAlgorithmsPrivate::qLowerBoundHelper(container.constBegin(), container.constEnd(), value, qLess<T>());}template <typename RandomAccessIterator, typename T>Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value){    // Implementation is duplicated from QAlgorithmsPrivate.    RandomAccessIterator middle;    int n = end - begin;    int half;    while (n > 0) {

⌨️ 快捷键说明

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