MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / const_iterator

Class const_iterator

src/prevector.h:100–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 };
99
100 class const_iterator {
101 const T* ptr;
102 public:
103 typedef Diff difference_type;
104 typedef const T value_type;
105 typedef const T* pointer;
106 typedef const T& reference;
107 typedef std::random_access_iterator_tag iterator_category;
108 const_iterator(const T* ptr_) : ptr(ptr_) {}
109 const_iterator(iterator x) : ptr(&(*x)) {}
110 const T& operator*() const { return *ptr; }
111 const T* operator->() const { return ptr; }
112 const T& operator[](size_type pos) const { return ptr[pos]; }
113 const_iterator& operator++() { ptr++; return *this; }
114 const_iterator& operator--() { ptr--; return *this; }
115 const_iterator operator++(int) { const_iterator copy(*this); ++(*this); return copy; }
116 const_iterator operator--(int) { const_iterator copy(*this); --(*this); return copy; }
117 difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
118 const_iterator operator+(size_type n) { return const_iterator(ptr + n); }
119 const_iterator& operator+=(size_type n) { ptr += n; return *this; }
120 const_iterator operator-(size_type n) { return const_iterator(ptr - n); }
121 const_iterator& operator-=(size_type n) { ptr -= n; return *this; }
122 bool operator==(const_iterator x) const { return ptr == x.ptr; }
123 bool operator!=(const_iterator x) const { return ptr != x.ptr; }
124 bool operator>=(const_iterator x) const { return ptr >= x.ptr; }
125 bool operator<=(const_iterator x) const { return ptr <= x.ptr; }
126 bool operator>(const_iterator x) const { return ptr > x.ptr; }
127 bool operator<(const_iterator x) const { return ptr < x.ptr; }
128 };
129
130 class const_reverse_iterator {
131 const T* ptr;

Callers 4

operator+Method · 0.85
operator-Method · 0.85
beginMethod · 0.85
endMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected