From 8e1004b2a30b3c79a46b76cf9d49cfd187ae461d Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 4 Jun 2024 08:34:42 -0400 Subject: [PATCH] cwVectOps.h : Added find() and count(). --- cwVectOps.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/cwVectOps.h b/cwVectOps.h index bc8f087..ddd9123 100644 --- a/cwVectOps.h +++ b/cwVectOps.h @@ -169,6 +169,30 @@ namespace cw return v0; } + + + //================================================================================================================== + // find, count + // + + template< typename T0, typename T1 > + unsigned find( const T0* v, unsigned n, const T1& m ) + { + for(unsigned i=0; i + unsigned count( const T0* v, unsigned n, const T1& m ) + { + unsigned cnt = 0; + for(unsigned i=0; i