CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/CommonTools/Utils/interface/PointerComparator.h

Go to the documentation of this file.
00001 #ifndef CommonTools_Utils_PointerComparator_h
00002 #define CommonTools_Utils_PointerComparator_h
00003 
00014 #include "FWCore/Utilities/interface/EDMException.h"
00015 
00016 template<typename C>
00017 struct PointerComparator {
00018   typedef typename C::first_argument_type first_argument_type;
00019   typedef typename C::second_argument_type second_argument_type;
00020     bool operator()( const first_argument_type * t1, const second_argument_type * t2 ) const {
00021       if ( t1 == 0 || t2 == 0 )
00022         throw edm::Exception( edm::errors::NullPointerError )
00023           << "PointerComparator: passed null pointer."; 
00024         return cmp( *t1, *t2 );
00025     }
00026   C cmp;
00027 };
00028 
00029 
00030 #endif