Skip to content

Commit

Permalink
Add enumerate_with<counter_type> to allow control of that
Browse files Browse the repository at this point in the history
  • Loading branch information
rupertnash committed May 20, 2024
1 parent 1565864 commit 0607a4a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Code/util/Iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ namespace hemelb::util
return {begin(std::forward<C>(c)), end(std::forward<C>(c))};
}

//! Ranged-for loops with enumeration
template<class CounterT, class C>
auto enumerate_with(C&& c) -> Enumerate<decltype(begin(std::forward<C>(c))), CounterT>
{
return {begin(std::forward<C>(c)), end(std::forward<C>(c))};
}

//! Ranged-for loops with enumeration
template<class CONTAINER>
auto cenumerate(CONTAINER const &x) -> Enumerate<decltype(begin(x))>
Expand Down

0 comments on commit 0607a4a

Please sign in to comment.