CMS 3D CMS Logo

GetProduct.h
Go to the documentation of this file.
1 #ifndef DataFormats_Common_GetProduct_h
2 #define DataFormats_Common_GetProduct_h
3 // -*- C++ -*-
4 //
5 // Package: Common
6 // Class : GetProduct
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Sat Oct 20 10:20:20 EDT 2007
19 //
20 
21 // system include files
22 
23 #include <memory>
24 #include <vector>
25 
26 // user include files
27 
28 // forward declarations
29 
30 namespace edm {
31  namespace detail {
32  template <typename COLLECTION>
33  struct GetProduct {
35  typedef typename COLLECTION::const_iterator iter;
36  static const element_type* address(const iter& i) { return &*i; }
37  };
38 
39  // Specialize for vector<unique_ptr<T>>>
40  template <typename T, typename D, typename A>
41  struct GetProduct<std::vector<std::unique_ptr<T, D>, A> > {
42  using element_type = T;
43  using iter = typename std::vector<std::unique_ptr<T, D>, A>::const_iterator;
44  static const element_type* address(const iter& i) { return i->get(); }
45  };
46  } // namespace detail
47 } // namespace edm
48 
49 #endif
COLLECTION::const_iterator iter
Definition: GetProduct.h:35
static const element_type * address(const iter &i)
Definition: GetProduct.h:36
static const element_type * address(const iter &i)
Definition: GetProduct.h:44
COLLECTION::value_type element_type
Definition: GetProduct.h:34
typename std::vector< std::unique_ptr< T, D >, A >::const_iterator iter
Definition: GetProduct.h:43
HLT enums.
Definition: APVGainStruct.h:7
long double T