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