Re-implement QVector::count

There is no need for a custom algorithm as we can use
std::count

Change-Id: Id1ab514c7cd8f52efe49b27712121415d7ca4455
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
bb10
João Abecasis 2012-09-11 11:26:53 +02:00 committed by Marc Mutz
parent 03ff5b35a5
commit 5026835690
1 changed files with 1 additions and 7 deletions

View File

@ -810,13 +810,7 @@ bool QVector<T>::contains(const T &t) const
template <typename T>
int QVector<T>::count(const T &t) const
{
int c = 0;
T* b = d->begin();
T* i = d->end();
while (i != b)
if (*--i == t)
++c;
return c;
return int(std::count(cbegin(), cend(), t));
}
template <typename T>