CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
const_iterator.h
Go to the documentation of this file.
1 #ifndef Candidate_const_iterator_h
2 #define Candidate_const_iterator_h
3 /* \class reco::candidate::const_iterator
4  *
5  * \author Luca Lista, INFN
6  *
7  */
10 
11 namespace reco {
12  namespace candidate {
13  struct iterator;
14 
15  struct const_iterator {
16  typedef const Candidate value_type;
17  typedef const Candidate * pointer;
18  typedef const Candidate & reference;
19  typedef ptrdiff_t difference_type;
20  typedef std::vector<int>::const_iterator::iterator_category iterator_category;
21  const_iterator() : i( 0 ) { }
22  const_iterator( const_iterator_imp * it ) : i( it ) { }
23  const_iterator( const const_iterator & it ) : i( it.i->clone() ) { }
24  const_iterator( const iterator & it );
25  ~const_iterator() { delete i; }
26  const_iterator & operator=( const const_iterator & it ) { i->assign( it.i ); return *this; }
27  const_iterator& operator++() { i->increase(); return *this; }
28  const_iterator operator++( int ) { const_iterator ci = *this; i->increase(); return ci; }
29  const_iterator& operator--() { i->decrease(); return *this; }
30  const_iterator operator--( int ) { const_iterator ci = *this; i->decrease(); return ci; }
31  difference_type operator-( const const_iterator & o ) const { return i->difference( o.i ); }
33  const_iterator_imp * ii = i->clone(); ii->increase( n );
34  return const_iterator( ii );
35  }
37  const_iterator_imp * ii = i->clone(); ii->decrease( n );
38  return const_iterator( ii );
39  }
40  bool operator<( const const_iterator & o ) const { return i->less_than( o.i ); }
41  bool operator==( const const_iterator& ci ) const { return i->equal_to( ci.i ); }
42  bool operator!=( const const_iterator& ci ) const { return ! i->equal_to( ci.i ); }
43  const Candidate & operator * () const { return i->deref(); }
44  const Candidate * operator->() const { return & ( operator*() ); }
45  const_iterator & operator +=( difference_type d ) { i->increase( d ); return *this; }
46  const_iterator & operator -=( difference_type d ) { i->decrease( d ); return *this; }
47 
48  private:
50  };
51  }
52 }
53 
54 #endif
difference_type operator-(const const_iterator &o) const
const_iterator & operator+=(difference_type d)
virtual bool less_than(const const_iterator_imp *) const =0
virtual const_iterator_imp * clone() const =0
const_iterator operator+(difference_type n) const
const_iterator operator++(int)
bool operator!=(const const_iterator &ci) const
int ii
Definition: cuy.py:588
const_iterator(const_iterator_imp *it)
const Candidate & operator*() const
const_iterator operator-(difference_type n) const
const_iterator(const const_iterator &it)
std::vector< int >::const_iterator::iterator_category iterator_category
const_iterator & operator=(const const_iterator &it)
const_iterator operator--(int)
TEveGeoShape * clone(const TEveElement *element, TEveElement *parent)
Definition: eve_macros.cc:135
bool operator==(const const_iterator &ci) const
virtual void assign(const const_iterator_imp *)=0
const_iterator & operator-=(difference_type d)
const Candidate * operator->() const
virtual difference_type difference(const const_iterator_imp *) const =0
virtual const Candidate & deref() const =0
virtual bool equal_to(const const_iterator_imp *) const =0
bool operator<(const const_iterator &o) const