File indexing completed on 2024-04-06 12:01:18
0001 #ifndef CommonTools_Utils_PointerComparator_h
0002 #define CommonTools_Utils_PointerComparator_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "FWCore/Utilities/interface/EDMException.h"
0015
0016 template <typename C>
0017 struct PointerComparator {
0018 typedef typename C::first_argument_type first_argument_type;
0019 typedef typename C::second_argument_type second_argument_type;
0020 bool operator()(const first_argument_type* t1, const second_argument_type* t2) const {
0021 if (t1 == nullptr || t2 == nullptr)
0022 throw edm::Exception(edm::errors::NullPointerError) << "PointerComparator: passed null pointer.";
0023 return cmp(*t1, *t2);
0024 }
0025 C cmp;
0026 };
0027
0028 #endif