1 #ifndef PhysicsTools_PatUtils_GenericDuplicateRemover_h 2 #define PhysicsTools_PatUtils_GenericDuplicateRemover_h 10 template <
typename Comparator,
typename Arbitrator>
26 template <
typename Collection>
27 std::unique_ptr< std::vector<size_t> >
37 template<
typename Comparator,
typename Arbitrator>
38 template<
typename Collection>
39 std::unique_ptr< std::vector<size_t> >
42 size_t size = items.size();
44 std::vector<bool> bad(size,
false);
46 for (
size_t ie = 0; ie <
size; ++ie) {
47 if (bad[ie])
continue;
49 for (
size_t je = ie+1; je <
size; ++je) {
51 if (bad[je])
continue;
54 int toRemove =
arbiter_(items[ie], items[je]) ? je : ie;
60 auto ret = std::make_unique<std::vector<size_t>>();
62 for (
size_t i = 0;
i <
size; ++
i) {
63 if (bad[
i]) ret->push_back(i);
GenericDuplicateRemover()
GenericDuplicateRemover(const Comparator &comp, const Arbitrator &arbiter)
std::unique_ptr< std::vector< size_t > > duplicates(const Collection &items) const
~GenericDuplicateRemover()
GenericDuplicateRemover(const Comparator &comp)