template typename typename QVector QPair zip const std vector const st

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
template < typename A,
typename B >
QVector<QPair<A, B> >
zip(const std::vector<A> & a, const std::vector<B> & b)
{
QVector<QPair<A, B> > result;
size_t m = min(a.size(), b.size());
for(size_t i = 0; i < m; ++i) result.append(qMakePair(a[i], b[i]));
return result;
}