CMS 3D CMS Logo

RefTraits.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_RefTraits_h
2 #define DataFormats_Common_RefTraits_h
3 
4 #include <algorithm>
5 
6 namespace edm {
7  template<typename C, typename T, typename F> class RefVector;
8  template<typename T> class RefToBaseVector;
9 
10  namespace refhelper {
11  template<typename C, typename T>
13  typedef C const& first_argument_type;
14  typedef unsigned int second_argument_type;
15  typedef T const* result_type;
16 
17  result_type operator()(first_argument_type iContainer, second_argument_type iIndex) {
18  typename C::const_iterator it = iContainer.begin();
19  std::advance(it, static_cast<typename C::size_type>(iIndex));
20  return it.operator->();
21  }
22  };
23 
24  template<typename REFV>
26  using first_argument_type = REFV const&;
27  using second_argument_type = typename REFV::key_type;
28  using result_type = typename REFV::member_type const*;
29 
31  typename REFV::const_iterator it = iContainer.begin();
32  std::advance(it, iIndex);
33  return it.operator->()->get();
34  }
35  };
36 
37  //Used in edm::Ref to set the default 'find' method to use based on the Container and 'contained' type
38  template<typename C, typename T>
39  struct FindTrait {
41  };
42 
43  template<typename C, typename T, typename F>
44  struct FindTrait<RefVector<C, T, F>, T> {
46  };
47 
48  template<typename T>
51  };
52 
53  template<typename C>
54  struct ValueTrait {
55  typedef typename C::value_type value;
56  };
57 
58  template<typename C, typename T, typename F>
59  struct ValueTrait<RefVector<C, T, F> > {
60  typedef T value;
61  };
62 
63  template<typename T>
65  typedef T value;
66  };
67 
68  }
69 
70 }
71 #endif
FindRefVectorUsingAdvance< RefToBaseVector< T > > value
Definition: RefTraits.h:50
FindRefVectorUsingAdvance< RefVector< C, T, F > > value
Definition: RefTraits.h:45
HLT enums.
typename REFV::member_type const * result_type
Definition: RefTraits.h:28
FindUsingAdvance< C, T > value
Definition: RefTraits.h:40
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
result_type operator()(first_argument_type iContainer, second_argument_type iIndex)
Definition: RefTraits.h:17
long double T
edm::RefVector< Container > RefVector
typename REFV::key_type second_argument_type
Definition: RefTraits.h:27
result_type operator()(first_argument_type iContainer, second_argument_type iIndex)
Definition: RefTraits.h:30