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
parent
03ff5b35a5
commit
5026835690
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Reference in New Issue