RangeFeed.h
Go to the documentation of this file.
1 #ifndef WIRECELL_RANGEFEED
2 #define WIRECELL_RANGEFEED
3 
4 namespace WireCell {
5 
6  template <typename Iter>
7  struct RangeFeed {
8  typedef typename Iter::value_type value_type;
9  Iter m_begin, m_end;
10  RangeFeed(const Iter& begin, const Iter& end) : m_begin(begin), m_end(end) {}
11  value_type operator()() {
12  if (m_begin == m_end) {
13  return nullptr;
14  }
15  value_type ret = *m_begin;
16  ++m_begin;
17  return ret;
18  }
19  };
20 
21 }
22 #endif
23 
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:72
value_type operator()()
Definition: RangeFeed.h:11
Iter::value_type value_type
Definition: RangeFeed.h:8
RangeFeed(const Iter &begin, const Iter &end)
Definition: RangeFeed.h:10
Definition: Main.h:22
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:67