NumberIterator.h
Go to the documentation of this file.
1 #ifndef INSIGHTS_NUMBER_ITERATOR_H
2 #define INSIGHTS_NUMBER_ITERATOR_H
3 
4 template<typename T>
6 {
7  const T mNum;
8  T mCount{};
9 
10 public:
11  NumberIterator(const T num)
12  : mNum{num}
13  {
14  }
15 
16  const T& operator*() const { return mCount; }
17 
19  {
20  ++mCount;
21 
22  return *this;
23  }
24 
25  struct sentinel
26  {
27  };
28 
29  bool operator==(sentinel) const { return mCount >= mNum; }
30 
31  const NumberIterator& begin() const { return *this; }
32  const sentinel end() const { return {}; }
33 };
34 //-----------------------------------------------------------------------------
35 
36 #endif /* INSIGHTS_NUMBER_ITERATOR_H */
const NumberIterator & begin() const
NumberIterator & operator++()
const sentinel end() const
NumberIterator(const T num)
const T & operator*() const
bool operator==(sentinel) const