10 #ifndef LARCOREALG_COREUTILS_GET_ELEMENTS_H 11 #define LARCOREALG_COREUTILS_GET_ELEMENTS_H 19 #include <type_traits> 67 template <std::size_t... Indices,
typename Coll>
78 template <
std::
size_t... Indices, typename Coll>
95 template <
typename Coll, std::size_t First, std::size_t... Others>
99 static constexpr decltype(
auto) iterate(T&& coll) noexcept
101 auto extractor = [](
auto&& item) -> decltype(
auto) {
102 if constexpr (
sizeof...(Others) == 0U) {
return util::get<First>(item); }
104 return std::forward_as_tuple(util::get<First>(item), util::get<Others...>(item));
117 template <std::size_t... Indices,
typename Coll>
120 static_assert(
sizeof...(Indices) >= 1U,
"At least one index must be specified");
122 std::forward<Coll>(coll));
126 template <std::size_t... Indices,
typename Coll>
134 #endif // LARCOREALG_COREUTILS_GET_ELEMENTS_H Namespace for general, non-LArSoft-specific utilities.
An object with a begin and end iterator.
decltype(auto) get_elements(Coll &&coll)
Range-for loop helper iterating across some of the element of each value in the specified collection...
decltype(auto) get_const_elements(Coll &&coll)
Range-for loop helper iterating across the constant values of the specified collection.
auto make_transformed_span(BIter begin, EIter end, Op &&op)
Functions pulling in STL customization if available.