1 #ifndef FWCore_Utilities_Algorithms_h 2 #define FWCore_Utilities_Algorithms_h 13 template <
typename ForwardSequence,
typename Func>
15 return std::for_each(s.begin(), s.end(),
f);
19 template <
typename ForwardSequence,
typename Func>
25 template <
typename ForwardSequence,
typename Datum>
26 inline typename ForwardSequence::const_iterator
find_in_all(ForwardSequence
const&
s, Datum
const&
d) {
30 template <
typename ForwardSequence,
typename Datum>
31 inline typename ForwardSequence::iterator
find_in_all(ForwardSequence&
s, Datum
const&
d) {
35 template <
typename ForwardSequence,
typename Datum>
37 return std::find(s.begin(), s.end(),
d) != s.end();
41 template <
typename ForwardSequence,
typename Predicate>
42 inline typename ForwardSequence::const_iterator
find_if_in_all(ForwardSequence
const&
s, Predicate
const&
p) {
43 return std::find_if(s.begin(), s.end(),
p);
46 template <
typename ForwardSequence,
typename Predicate>
47 inline typename ForwardSequence::iterator
find_if_in_all(ForwardSequence&
s, Predicate
const&
p) {
48 return std::find_if(s.begin(), s.end(),
p);
51 template <
typename ForwardSequence,
typename Predicate>
53 return std::find_if(s.begin(), s.end(),
p) != s.end();
57 template <
typename ForwardSequence,
typename Datum>
59 return std::binary_search(s.begin(), s.end(),
d);
62 template <
typename ForwardSequence,
typename Datum,
typename Predicate>
64 return std::binary_search(s.begin(), s.end(),
d,
p);
68 template <
typename ForwardSequence,
typename Datum>
69 inline typename ForwardSequence::const_iterator
lower_bound_all(ForwardSequence
const&
s, Datum
const&
d) {
70 return std::lower_bound(s.begin(), s.end(),
d);
73 template <
typename ForwardSequence,
typename Datum>
74 inline typename ForwardSequence::iterator
lower_bound_all(ForwardSequence&
s, Datum
const&
d) {
75 return std::lower_bound(s.begin(), s.end(),
d);
78 template <
typename ForwardSequence,
typename Datum,
typename Predicate>
79 inline typename ForwardSequence::const_iterator
lower_bound_all(ForwardSequence
const&
s,
82 return std::lower_bound(s.begin(), s.end(),
d,
p);
85 template <
typename ForwardSequence,
typename Datum,
typename Predicate>
86 inline typename ForwardSequence::iterator
lower_bound_all(ForwardSequence&
s, Datum
const&
d, Predicate
p) {
87 return std::lower_bound(s.begin(), s.end(),
d,
p);
91 template <
typename RandomAccessSequence>
93 std::sort(s.begin(), s.end());
96 template <
typename RandomAccessSequence,
typename Predicate>
97 inline void sort_all(RandomAccessSequence&
s, Predicate
p) {
98 std::sort(s.begin(), s.end(),
p);
102 template <
typename RandomAccessSequence>
104 std::stable_sort(s.begin(), s.end());
107 template <
typename RandomAccessSequence,
typename Predicate>
109 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