LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
enumerate.h
Go to the documentation of this file.
1 
10 #ifndef LARCOREALG_COREUTILS_ENUMERATE_H
11 #define LARCOREALG_COREUTILS_ENUMERATE_H
12 
13 // LArSoft libraries
16 
17 // C/C++ libraries
18 #include <cstddef> // std::size_t
19 #include <utility> // std::forward()
20 
21 namespace util {
22 
23  // -- BEGIN -- Enumerated iterations -----------------------------------------
26 
48  template <typename... Iterables>
49  auto enumerate(Iterables&&... iterables)
50  {
51  return zip<1u>(infinite_counter(), std::forward<Iterables>(iterables)...);
52  }
53 
55  // --- END -- Enumerated iterations ------------------------------------------
56 
57 } // namespace util
58 
59 #endif // LARCOREALG_COREUTILS_ENUMERATE_H
Definition of util::zip().
Namespace for general, non-LArSoft-specific utilities.
Definition: PIDAAlg.h:26
auto infinite_counter(T begin=T{})
Version of util::counter() starting at begin and never ending.
Definition: counter.h:299
auto enumerate(Iterables &&...iterables)
Range-for loop helper tracking the number of iteration.
Definition: enumerate.h:49
Test of util::counter and support utilities.