CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CollectionFilterTrait.h
Go to the documentation of this file.
1 #ifndef UtilAlgos_CollectionFilterTrait_h
2 #define UtilAlgos_CollectionFilterTrait_h
3 /* \class CollectionFilterTrait<C, S, N>
4  *
5  * \author Luca Lista, INFN
6  *
7  */
10 
11 namespace helper {
12 
13  template<typename C, typename S, typename N>
15  static bool filter( const C & source, const S & select, const N & sizeSelect ) {
16  size_t n = 0;
17  for( typename C::const_iterator i = source.begin(); i != source.end(); ++ i )
18  if ( select( * i ) ) n ++;
19  return sizeSelect( n );
20  }
21  };
22 
23  template<typename C, typename S>
25  static bool filter( const C& source, const S & select, const MinNumberSelector & sizeSelect ) {
26  size_t n = 0;
27  for( typename C::const_iterator i = source.begin(); i != source.end(); ++ i ) {
28  if ( select( * i ) ) n ++;
29  if ( sizeSelect( n ) ) return true;
30  }
31  return false;
32  }
33  };
34 
35  template<typename C, typename N>
37  template<typename S>
38  static bool filter( const C & source, const S & , const N & sizeSelect ) {
39  return sizeSelect( source.size() );
40  }
41  };
42 
43  template<typename C, typename S, typename N>
46  };
47 
48  template<typename C, typename N>
51  };
52 
53 }
54 
55 #endif
56 
int i
Definition: DBlmapReader.cc:9
static bool filter(const C &source, const S &, const N &sizeSelect)
CollectionFilter< C, S, N > type
static bool filter(const C &source, const S &select, const MinNumberSelector &sizeSelect)
#define N
Definition: blowfish.cc:9
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:99
static bool filter(const C &source, const S &select, const N &sizeSelect)
static std::string const source
Definition: EdmProvDump.cc:42