File indexing completed on 2024-04-06 12:03:51
0001 #ifndef DataFormats_Common_GetProduct_h
0002 #define DataFormats_Common_GetProduct_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include <memory>
0024 #include <vector>
0025
0026
0027
0028
0029
0030 namespace edm {
0031 namespace detail {
0032 template <typename COLLECTION>
0033 struct GetProduct {
0034 typedef typename COLLECTION::value_type element_type;
0035 typedef typename COLLECTION::const_iterator iter;
0036 static const element_type* address(const iter& i) { return &*i; }
0037 };
0038
0039
0040 template <typename T, typename D, typename A>
0041 struct GetProduct<std::vector<std::unique_ptr<T, D>, A> > {
0042 using element_type = T;
0043 using iter = typename std::vector<std::unique_ptr<T, D>, A>::const_iterator;
0044 static const element_type* address(const iter& i) { return i->get(); }
0045 };
0046 }
0047 }
0048
0049 #endif