1 #ifndef PhysicsTools_PatUtils_GenericDuplicateRemover_h
2 #define PhysicsTools_PatUtils_GenericDuplicateRemover_h
9 template <
typename Comparator,
typename Arbitrator>
25 template <
typename Collection>
26 std::auto_ptr< std::vector<size_t> >
36 template<
typename Comparator,
typename Arbitrator>
37 template<
typename Collection>
38 std::auto_ptr< std::vector<size_t> >
41 size_t size = items.size();
43 std::vector<bool>
bad(size,
false);
45 for (
size_t ie = 0; ie <
size; ++ie) {
46 if (bad[ie])
continue;
48 for (
size_t je = ie+1; je <
size; ++je) {
50 if (bad[je])
continue;
52 if ( comparator_(items[ie], items[je]) ) {
53 int toRemove = arbiter_(items[ie], items[je]) ? je : ie;
59 std::auto_ptr< std::vector<size_t> >
ret(
new std::vector<size_t>());
61 for (
size_t i = 0;
i <
size; ++
i) {
62 if (bad[
i]) ret->push_back(i);
std::auto_ptr< std::vector< size_t > > duplicates(const Collection &items) const
GenericDuplicateRemover()
int bad(Items const &cont)
GenericDuplicateRemover(const Comparator &comp, const Arbitrator &arbiter)
~GenericDuplicateRemover()
GenericDuplicateRemover(const Comparator &comp)
tuple size
Write out results.