LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
ContainerMeta.h
Go to the documentation of this file.
1 
9 #ifndef LARCOREALG_COREUTILS_CONTAINERMETA_H
10 #define LARCOREALG_COREUTILS_CONTAINERMETA_H
11 
12 // LArSoft
13 #include "larcorealg/CoreUtils/MetaUtils.h" // for Doxygen documentation
14 
15 // C/C++ standard libraries
16 #include <iterator> // std::begin(), std::cbegin()
17 #include <utility> // std::declval()
18 
19 
20 namespace util {
21 
22 
23  //--- BEGIN ContainerMetaprogramming -----------------------------------------
52 
54 
55  //----------------------------------------------------------------------------
57  template <typename Coll>
59  using type = typename Coll::value_type;
60  using value_type = type;
61  }; // struct collection_value_type
62 
64  template <typename Coll>
66 
67 
68  //----------------------------------------------------------------------------
70  template <typename Coll>
72  private:
73  static auto getBegin(Coll&& coll) { using std::begin; return begin(coll); }
74 
75  public:
76  using type = decltype(*getBegin(std::declval<Coll>()));
78 
79  }; // struct collection_value_access_type
80 
82  template <typename Coll>
85 
86 
87  //----------------------------------------------------------------------------
89  template <typename Coll>
91  private:
92  static auto getCBegin(Coll&& coll)
93  { using std::cbegin; return cbegin(coll); }
94 
95  public:
96  using type = decltype(*getCBegin(std::declval<Coll>()));
98 
99  }; // struct collection_value_constant_access_type
100 
102  template <typename Coll>
105 
106 
108  //--- END ContainerMetaprogramming -------------------------------------------
109 
110 
111 } // namespace util
112 
113 
114 //------------------------------------------------------------------------------
115 
116 #endif // LARCOREALG_COREUTILS_CONTAINERMETA_H
117 
typename collection_value_access_type< Coll >::type collection_value_access_t
Type obtained by constant access to element of collection Coll.
Definition: ContainerMeta.h:84
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:17
Basic C++ metaprogramming utilities.
Trait of type obtained by constant access to element of collection Coll.
Definition: ContainerMeta.h:90
decltype(*getBegin(std::declval< Coll >())) type
Definition: ContainerMeta.h:76
Trait of type obtained by access to element of collection Coll.
Definition: ContainerMeta.h:71
collection_value_t< Coll > value_type
Definition: ContainerMeta.h:97
collection_value_t< Coll > value_type
Definition: ContainerMeta.h:77
decltype(*getCBegin(std::declval< Coll >())) type
Definition: ContainerMeta.h:96
std::vector< evd::details::RawDigitInfo_t >::const_iterator begin(RawDigitCacheDataClass const &cache)
typename collection_value_type< Coll >::type collection_value_t
Type contained in the collection Coll.
Definition: ContainerMeta.h:65
typename Coll::value_type type
Definition: ContainerMeta.h:59
static auto getBegin(Coll &&coll)
Definition: ContainerMeta.h:73
typename collection_value_constant_access_type< Coll >::type collection_value_constant_access_t
Type obtained by constant access to element of collection Coll.
Trait of value contained in the template collection Coll.
Definition: ContainerMeta.h:58