C++ (Qt)#include <QList>#include <QDebug>#include <iterator> int main(){ QList<int> a = {1, 2, 7}; QList<int> b = {1, 2, 3, 4, 5, 6, 7}; std::copy(b.begin() + 2, b.end() - 1, std::inserter(a, a.begin() + 2)); qDebug() << a;}
C++ (Qt)template <typename T>inline typename QList<T>::iterator QList<T>::insert(iterator before, const T &t){ Q_ASSERT_X(isValidIterator(before), "QList::insert", "The specified iterator argument 'before' is invalid");
std::vector<T *> src, dst;...dst.insert(dst.begin() + insertPos, src.begin(), src.end());src.clear();
C++ (Qt)QList<T> src. dst;...for (int i = 0; i < src.size(); ++i) dst.insert(insertPos + i, src[i]);
std::map<Key, Value> map = {};for (const auto &item: map) { const auto &key = item.first; const auto &value = item.second; foo(key, value);}
QMap<Key, Value> map = {};for (const auto it = map.constBegin(), end = map.constEnd(); it != end; ++it) { const auto &key = it->key(); const auto &value = it->value(); foo(key, value);}