97 typedef ContainerType container_type;
98 typedef SizeType size_type;
99 typedef std::random_access_iterator_tag iterator_category;
100 typedef ValueType value_type;
101 typedef DifferenceType difference_type;
102 typedef PointerType pointer;
103 typedef ReferenceType reference;
105 index_iterator_t(ContainerType& container, size_type index): container_(&container), index_(
static_cast<difference_type
>(index)) {}
107 pointer operator->()
const {
return &(*container_)[
static_cast<size_type
>(index_)]; }
108 reference operator*()
const {
return (*container_)[
static_cast<size_type
>(index_)]; }
110 index_iterator_t& operator++() { ++index_;
return *
this; }
111 index_iterator_t operator++(
int) {
return index_iterator_t(container_, index_++); }
112 index_iterator_t& operator--() { --index_;
return *
this; }
113 index_iterator_t operator--(
int) {
return index_iterator_t(container_, index_--); }
115 index_iterator_t& operator+=(difference_type n) { index_ += n;
return *
this; }
116 index_iterator_t operator+(difference_type n) {
return index_iterator_t(container_, index_ + n); }
117 index_iterator_t& operator-=(difference_type n) { index_ -= n;
return *
this; }
118 index_iterator_t operator-(difference_type n) {
return index_iterator_t(container_, index_ - n); }
120 reference operator[](difference_type n)
const {
return (*container_)[
static_cast<size_type
>(index_ + n)]; }
122 container_type* container()
const {
return container_; }
123 size_type index()
const {
return static_cast<size_type
>(index_); }
126 container_type* container_;
127 difference_type index_;
138bool operator==(
const index_iterator_t<C, V, R, P, S, D>& a,
const index_iterator_t<C, V, R, P, S, D>& b)
144bool operator!=(
const index_iterator_t<C, V, R, P, S, D>& a,
const index_iterator_t<C, V, R, P, S, D>& b)