00001 #ifndef Candidate_iterator_deref_h 00002 #define Candidate_iterator_deref_h 00003 00004 #include "DataFormats/Common/interface/OwnVector.h" 00005 #include "DataFormats/Common/interface/RefVector.h" 00006 #include "DataFormats/Common/interface/RefToBase.h" 00007 #include "DataFormats/Common/interface/Ptr.h" 00008 #include <boost/static_assert.hpp> 00009 #include <vector> 00010 00011 namespace reco { 00012 namespace candidate { 00013 00014 template<typename C> 00015 struct iterator_deref { 00016 BOOST_STATIC_ASSERT(sizeof(C) == 0); 00017 }; 00018 00019 template<typename T> 00020 struct iterator_deref<std::vector<T> > { 00021 static const Candidate & deref( const typename std::vector<T>::const_iterator & i ) { 00022 return * i; 00023 } 00024 }; 00025 00026 template<typename T> 00027 struct iterator_deref<edm::OwnVector<T> > { 00028 static const Candidate & deref( const typename edm::OwnVector<T>::const_iterator & i ) { 00029 return * i; 00030 } 00031 }; 00032 00033 template<typename C> 00034 struct iterator_deref<edm::RefVector<C> > { 00035 static const Candidate & deref( const typename edm::RefVector<C>::const_iterator & i ) { 00036 return * * i; 00037 } 00038 }; 00039 00040 template<typename T> 00041 struct iterator_deref<std::vector<edm::RefToBase<T> > > { 00042 static const Candidate & deref( const typename std::vector<edm::RefToBase<T> >::const_iterator & i ) { 00043 return * * i; 00044 } 00045 }; 00046 00047 template<typename T> 00048 struct iterator_deref<std::vector<edm::Ptr<T> > > { 00049 static const Candidate & deref( const typename std::vector<edm::Ptr<T> >::const_iterator & i ) { 00050 return * * i; 00051 } 00052 }; 00053 } 00054 } 00055 00056 #endif