Remove qCopy from QLinkedList / QVector

QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I5f7c2a6b3588a07113061c018e2870f476bea5a7
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
This commit is contained in:
Giuseppe D'Angelo 2013-09-03 22:11:20 +02:00 committed by The Qt Project
parent ec846146b4
commit 8c4323c74d
2 changed files with 6 additions and 4 deletions

View File

@ -221,9 +221,9 @@ public:
typedef qptrdiff difference_type;
static inline QLinkedList<T> fromStdList(const std::list<T> &list)
{ QLinkedList<T> tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; }
{ QLinkedList<T> tmp; std::copy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; }
inline std::list<T> toStdList() const
{ std::list<T> tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
{ std::list<T> tmp; std::copy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
// comfort
QLinkedList<T> &operator+=(const QLinkedList<T> &l);

View File

@ -56,6 +56,8 @@
#include <initializer_list>
#endif
#include <algorithm>
QT_BEGIN_NAMESPACE
class QRegion;
@ -227,9 +229,9 @@ public:
static QVector<T> fromList(const QList<T> &list);
static inline QVector<T> fromStdVector(const std::vector<T> &vector)
{ QVector<T> tmp; tmp.reserve(int(vector.size())); qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
{ QVector<T> tmp; tmp.reserve(int(vector.size())); std::copy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; }
inline std::vector<T> toStdVector() const
{ std::vector<T> tmp; tmp.reserve(size()); qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
{ std::vector<T> tmp; tmp.reserve(size()); std::copy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; }
private:
friend class QRegion; // Optimization for QRegion::rects()