From 5026835690bac0ec0d3e0ef565e21b35329fdaf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Tue, 11 Sep 2012 11:26:53 +0200 Subject: [PATCH] Re-implement QVector::count MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no need for a custom algorithm as we can use std::count Change-Id: Id1ab514c7cd8f52efe49b27712121415d7ca4455 Reviewed-by: Jędrzej Nowacki Reviewed-by: Marc Mutz Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/qvector.h | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index c547cec7be..f09f1a3c41 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -810,13 +810,7 @@ bool QVector::contains(const T &t) const template int QVector::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