10 #ifndef LARCOREALG_COREUTILS_GET_ELEMENTS_H
11 #define LARCOREALG_COREUTILS_GET_ELEMENTS_H
20 #include <type_traits>
70 template <std::size_t... Indices,
typename Coll>
81 template <
std::
size_t... Indices, typename Coll>
98 namespace util::details {
101 template <
typename Coll, std::size_t First, std::size_t... Others>
104 template <
typename T>
105 static constexpr decltype(
auto) iterate(T&& coll) noexcept
107 auto extractor = [](
auto&& item) -> decltype(
auto)
109 if constexpr(
sizeof...(Others) == 0U) {
110 return util::get<First>(item);
113 return std::forward_as_tuple
114 (util::get<First>(item), util::get<Others...>(item));
129 template <std::size_t... Indices,
typename Coll>
132 (
sizeof...(Indices) >= 1U,
"At least one index must be specified");
133 return details::get_elements_impl<std::decay_t<Coll>, Indices...>::iterate
134 (std::forward<Coll>(coll));
139 template <std::size_t... Indices,
typename Coll>
141 {
return get_elements<Indices...>(std::as_const(coll)); }
147 #endif // LARCOREALG_COREUTILS_GET_ELEMENTS_H
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
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.