CMS 3D CMS Logo

const_iterator.h
Go to the documentation of this file.
1 #ifndef Candidate_const_iterator_h
2 #define Candidate_const_iterator_h
3 
4 /* \class reco::candidate::const_iterator
5  *
6  * \author Luca Lista, INFN
7  *
8  */
11 
12 namespace reco {
13  namespace candidate {
14  struct const_iterator {
15  typedef const Candidate value_type;
16  typedef const Candidate * pointer;
17  typedef const Candidate & reference;
18  typedef ptrdiff_t difference_type;
19  typedef std::vector<int>::const_iterator::iterator_category iterator_category;
20  const_iterator() : me(nullptr), i( 0 ) { }
21  const_iterator(pointer ime, difference_type ii ) : me(ime), i(ii) { }
22  const_iterator(const iterator & it) : me(it.me), i(it.i) { }
23  const_iterator & operator=( const iterator & it ) { me = it.me; i=it.i; return *this; }
24  const_iterator& operator++() { ++i; return *this; }
25  const_iterator operator++( int ) { const_iterator ci = *this; ++i; return ci; }
26  const_iterator& operator--() { --i; return *this; }
27  const_iterator operator--( int ) { const_iterator ci = *this; --i; return ci; }
28  difference_type operator-( const const_iterator & o ) const { return i-o.i; }
29  const_iterator operator+( difference_type n ) const {
30  const_iterator ci = *this; ci.i+=n;
31  return ci;
32  }
33  const_iterator operator-( difference_type n ) const {
34  const_iterator ci = *this; ci.i-=n;
35  return ci;
36  }
37  bool operator<( const const_iterator & o ) { return i<o.i; }
38  bool operator==( const const_iterator& ci ) const { return i==ci.i; }
39  bool operator!=( const const_iterator& ci ) const { return i!=ci.i; }
40  inline reference operator * () const;
41  pointer operator->() const { return & ( operator*() ); }
42  const_iterator & operator +=( difference_type d ) { i+=d; return *this; }
43  const_iterator & operator -=( difference_type d ) { i-=d; return *this; }
44  private:
45  pointer me;
46  difference_type i;
47  };
48 
49  }
50 }
51 
52 #endif
difference_type operator-(const const_iterator &o) const
const_iterator & operator+=(difference_type d)
const_iterator operator+(difference_type n) const
const_iterator operator++(int)
bool operator!=(const const_iterator &ci) const
#define nullptr
reference operator*() const
Definition: Candidate.h:276
difference_type i
Definition: iterator.h:45
const_iterator operator-(difference_type n) const
const_iterator(pointer ime, difference_type ii)
ii
Definition: cuy.py:588
const_iterator & operator=(const iterator &it)
std::vector< int >::const_iterator::iterator_category iterator_category
const_iterator(const iterator &it)
const_iterator operator--(int)
bool operator<(const const_iterator &o)
bool operator==(const const_iterator &ci) const
fixed size matrix
const_iterator & operator-=(difference_type d)