CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
iterator.h
Go to the documentation of this file.
1 #ifndef Candidate_iterator_h
2 #define Candidate_iterator_h
3 
4 /* \class reco::candidate::iterator
5  *
6  * \author Luca Lista, INFN
7  *
8  */
10 
11 namespace reco {
12  namespace candidate {
13  struct const_iterator;
14  struct iterator {
16  typedef Candidate* pointer;
17  typedef Candidate& reference;
18  typedef ptrdiff_t difference_type;
19  typedef std::vector<int>::iterator::iterator_category iterator_category;
20  iterator() : me(nullptr), i(0) {}
21  iterator(pointer ime, difference_type ii) : me(ime), i(ii) {}
23  ++i;
24  return *this;
25  }
27  iterator ci = *this;
28  ++i;
29  return ci;
30  }
32  --i;
33  return *this;
34  }
36  iterator ci = *this;
37  --i;
38  return ci;
39  }
40  difference_type operator-(const iterator& o) const { return i - o.i; }
42  iterator ci = *this;
43  ci.i += n;
44  return ci;
45  }
47  iterator ci = *this;
48  ci.i -= n;
49  return ci;
50  }
51  bool operator<(const iterator& o) { return i < o.i; }
52  bool operator==(const iterator& ci) const { return i == ci.i; }
53  bool operator!=(const iterator& ci) const { return i != ci.i; }
54 
55  inline reference operator*() const;
56  pointer operator->() const { return &(operator*()); }
58  i += d;
59  return *this;
60  }
62  i -= d;
63  return *this;
64  }
65 
66  private:
69  friend struct const_iterator;
70  };
71 
72  } // namespace candidate
73 } // namespace reco
74 
75 #endif
iterator & operator+=(difference_type d)
Definition: iterator.h:57
std::vector< int >::iterator::iterator_category iterator_category
Definition: iterator.h:19
bool operator!=(const iterator &ci) const
Definition: iterator.h:53
pointer operator->() const
Definition: iterator.h:56
iterator operator-(difference_type n) const
Definition: iterator.h:46
ptrdiff_t difference_type
Definition: iterator.h:18
int ii
Definition: cuy.py:589
Candidate & reference
Definition: iterator.h:17
tuple d
Definition: ztail.py:151
difference_type i
Definition: iterator.h:68
iterator operator+(difference_type n) const
Definition: iterator.h:41
iterator operator++(int)
Definition: iterator.h:26
iterator operator--(int)
Definition: iterator.h:35
bool operator<(const iterator &o)
Definition: iterator.h:51
iterator & operator--()
Definition: iterator.h:31
bool operator==(const iterator &ci) const
Definition: iterator.h:52
iterator & operator-=(difference_type d)
Definition: iterator.h:61
difference_type operator-(const iterator &o) const
Definition: iterator.h:40
iterator(pointer ime, difference_type ii)
Definition: iterator.h:21
iterator & operator++()
Definition: iterator.h:22
reference operator*() const
Definition: Candidate.h:302