1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#ifndef RecoAlgos_StatusSelector_h
#define RecoAlgos_StatusSelector_h
/* \class StatusSelector
*
* \author Luca Lista, INFN
*
* $Id: StatusSelector.h,v 1.3 2007/06/18 18:33:54 llista Exp $
*/
#include <vector>
#include <algorithm>
struct StatusSelector {
StatusSelector(const std::vector<int>& status) {
for (std::vector<int>::const_iterator i = status.begin(); i != status.end(); ++i)
status_.push_back(*i);
begin_ = status_.begin();
end_ = status_.end();
}
StatusSelector(const StatusSelector& o) : status_(o.status_), begin_(status_.begin()), end_(status_.end()) {}
StatusSelector& operator=(const StatusSelector& o) = default;
StatusSelector& operator==(const StatusSelector& o) {
*this = o;
return *this;
}
template <typename T>
bool operator()(const T& t) const {
return std::find(begin_, end_, t.status()) != end_;
}
private:
std::vector<int> status_;
std::vector<int>::const_iterator begin_, end_;
};
#endif
|