9 #ifndef LARCOREALG_COREUTILS_CONTAINERMETA_H 10 #define LARCOREALG_COREUTILS_CONTAINERMETA_H 19 #include <type_traits> 57 template <
typename Coll>
61 template <
typename Coll>
66 template <
typename Coll>
70 template <
typename Coll>
75 template <
typename Coll>
79 template <
typename Coll>
98 template <
typename Coll>
102 template <
typename Coll>
119 template <
typename Coll>
134 template <
typename Cont>
138 template <
typename Cont>
155 template <
typename CollRef>
173 template <
typename Ptr>
176 template <
typename T>
182 template <
typename T>
188 template <
typename T, std::
size_t N>
194 template <
typename Ptr,
typename =
void>
198 template <
typename Coll,
typename =
void>
200 using type =
typename Coll::value_type;
204 template <
typename Coll>
208 template <
typename Coll>
210 std::enable_if_t<util::is_unique_ptr_v<std::decay_t<Coll>>>>
214 template <
typename Coll,
typename =
void>
224 using type = decltype(*getBegin(std::declval<Coll>()));
229 template <
typename T>
231 using type = decltype(*(std::declval<T*>()));
235 template <
typename Ptr>
238 std::enable_if_t<util::is_unique_ptr_v<std::decay_t<Ptr>>>>
242 template <
typename Coll,
typename =
void>
252 using type = decltype(*getCBegin(std::declval<Coll>()));
257 template <
typename T>
259 using type = decltype(*(std::declval<std::add_const_t<T>*>()));
263 template <
typename Ptr>
266 std::enable_if_t<util::is_unique_ptr_v<std::decay_t<Ptr>>>>
273 template <
typename Coll,
typename =
void>
275 using type = std::reference_wrapper<Coll>;
276 static auto make(Coll& coll) {
return std::ref(coll); }
279 template <
typename Coll>
281 std::enable_if_t<util::is_reference_wrapper_v<Coll>>> {
282 using type = std::remove_cv_t<Coll>;
286 template <
typename Coll>
288 using type =
typename Coll::pointer;
289 static type make(Coll& uptr) {
return uptr.get(); }
292 template <
typename Ptr>
294 std::enable_if_t<std::is_pointer_v<std::decay_t<Ptr>>>> {
295 using type = std::add_pointer_t<
296 std::remove_all_extents_t<
297 std::remove_pointer_t<std::decay_t<Ptr>>>>;
304 template <
typename CollRef,
typename =
void>
306 using type = std::add_lvalue_reference_t<std::remove_reference_t<CollRef>>;
307 static CollRef&
get(CollRef& coll) {
return coll; }
310 template <
typename CollRef>
312 std::enable_if_t<util::is_reference_wrapper_v<CollRef>>> {
313 using type = std::add_lvalue_reference_t<typename CollRef::type>;
314 static type get(CollRef& refw) {
return refw.get(); }
317 template <
typename CollRef>
319 std::enable_if_t<util::is_unique_ptr_v<CollRef>>> {
320 using type =
typename CollRef::pointer;
321 static type get(CollRef& uptr) {
return uptr.get(); }
324 template <
typename T>
327 static type get(T* ptr) {
return ptr; }
330 template <
typename T>
333 static type get(T ptr[]) {
return ptr; }
336 template <
typename T, std::
size_t N>
339 static type get(T ptr[N]) {
return ptr; }
347 template <
typename Coll>
356 template <
typename Coll>
361 template <
typename Coll>
364 util::strip_referenceness_t<Coll>> {};
367 template <
typename Coll>
372 template <
typename Coll>
379 template <
typename CollRef>
384 template <
typename CollRef>
396 #endif // LARCOREALG_COREUTILS_CONTAINERMETA_H
static type make(Ptr &ptr)
static CollRef & get(CollRef &coll)
Namespace for general, non-LArSoft-specific utilities.
collection_value_t< std::remove_reference_t< Ptr::pointer > > value_type
Trait of type obtained by constant access to element of collection Coll.
std::add_lvalue_reference_t< std::remove_reference_t< std::remove_reference_t< CollRef > >> type
static auto getCBegin(Coll &&coll)
Trait with the type of collection referenced by collRef.
Trait of type obtained by access to element of collection Coll.
collection_value_t< std::remove_reference_t< Ptr::pointer > > value_type
Ptr(H, T) -> Ptr< detail::not_map_vector_t< typename H::element_type >>
Trait of a type that can be used to reference the collection Coll.
std::add_const_t< T > value_type
decltype(*getBegin(std::declval< util::strip_referenceness_t< Coll > >())) type
std::reference_wrapper< std::remove_reference_t< Coll > > type
static type make(Coll &refw)
decltype(*getCBegin(std::declval< util::strip_referenceness_t< Coll > >())) type
static auto getBegin(Coll &&coll)
static type make(Coll &uptr)
decltype(auto) constexpr cbegin(T &&obj)
ADL-aware version of std::cbegin.
util::strip_referenceness_t< typename details::collection_value_type_impl< util::strip_referenceness_t< Coll >>::type > type
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Trait of value contained in the template collection Coll.
static auto make(Coll &coll)