1 #ifndef FWCore_Utilities_Algorithms_h
2 #define FWCore_Utilities_Algorithms_h
13 template <
typename ForwardSequence,
typename Func>
17 return std::for_each(s.begin(), s.end(),
f);
21 template <
typename ForwardSequence,
typename Func>
29 template <
typename ForwardSequence,
typename Datum>
31 typename ForwardSequence::const_iterator
36 template <
typename ForwardSequence,
typename Datum>
38 typename ForwardSequence::iterator
43 template <
typename ForwardSequence,
typename Datum>
47 return std::find(s.begin(), s.end(),
d) != s.end();
51 template <
typename ForwardSequence,
typename Predicate>
53 typename ForwardSequence::const_iterator
55 return std::find_if(s.begin(), s.end(),
p);
58 template <
typename ForwardSequence,
typename Predicate>
60 typename ForwardSequence::iterator
62 return std::find_if(s.begin(), s.end(),
p);
65 template <
typename ForwardSequence,
typename Predicate>
69 return std::find_if(s.begin(), s.end(),
p) != s.end();
73 template <
typename ForwardSequence,
typename Datum>
77 return std::binary_search(s.begin(), s.end(),
d);
80 template <
typename ForwardSequence,
typename Datum,
typename Predicate>
84 return std::binary_search(s.begin(), s.end(),
d,
p);
88 template <
typename ForwardSequence,
typename Datum>
90 typename ForwardSequence::const_iterator
92 return std::lower_bound(s.begin(), s.end(),
d);
95 template <
typename ForwardSequence,
typename Datum>
97 typename ForwardSequence::iterator
99 return std::lower_bound(s.begin(), s.end(),
d);
102 template <
typename ForwardSequence,
typename Datum,
typename Predicate>
104 typename ForwardSequence::const_iterator
106 return std::lower_bound(s.begin(), s.end(),
d,
p);
109 template <
typename ForwardSequence,
typename Datum,
typename Predicate>
111 typename ForwardSequence::iterator
113 return std::lower_bound(s.begin(), s.end(),
d,
p);
117 template <
typename RandomAccessSequence>
121 std::sort(s.begin(), s.end());
124 template <
typename RandomAccessSequence,
typename Predicate>
128 std::sort(s.begin(), s.end(),
p);
132 template <
typename RandomAccessSequence>
136 std::stable_sort(s.begin(), s.end());
139 template <
typename RandomAccessSequence,
typename Predicate>
143 std::stable_sort(s.begin(), s.end(),
p);
ForwardSequence::const_iterator lower_bound_all(ForwardSequence const &s, Datum const &d)
wrappers for std::lower_bound
bool search_if_in_all(ForwardSequence const &s, Predicate const &p)
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Func for_all(ForwardSequence &s, Func f)
wrapper for std::for_each
void sort_all(RandomAccessSequence &s)
wrappers for std::sort
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
bool search_all(ForwardSequence const &s, Datum const &d)
Func copy_all(ForwardSequence &s, Func f)
wrappers for copy
bool binary_search_all(ForwardSequence const &s, Datum const &d)
wrappers for std::binary_search
ForwardSequence::const_iterator find_if_in_all(ForwardSequence const &s, Predicate const &p)
wrappers for std::find