|
|
@ -98,16 +98,16 @@ class autovector { |
|
|
|
return old; |
|
|
|
return old; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
self_type operator-(difference_type len) { |
|
|
|
self_type operator-(difference_type len) const { |
|
|
|
return self_type(vect_, index_ - len); |
|
|
|
return self_type(vect_, index_ - len); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
difference_type operator-(const self_type& other) { |
|
|
|
difference_type operator-(const self_type& other) const { |
|
|
|
assert(vect_ == other.vect_); |
|
|
|
assert(vect_ == other.vect_); |
|
|
|
return index_ - other.index_; |
|
|
|
return index_ - other.index_; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
self_type operator+(difference_type len) { |
|
|
|
self_type operator+(difference_type len) const { |
|
|
|
return self_type(vect_, index_ + len); |
|
|
|
return self_type(vect_, index_ + len); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -126,11 +126,23 @@ class autovector { |
|
|
|
assert(vect_->size() >= index_); |
|
|
|
assert(vect_->size() >= index_); |
|
|
|
return (*vect_)[index_]; |
|
|
|
return (*vect_)[index_]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const_reference operator*() const { |
|
|
|
|
|
|
|
assert(vect_->size() >= index_); |
|
|
|
|
|
|
|
return (*vect_)[index_]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
pointer operator->() { |
|
|
|
pointer operator->() { |
|
|
|
assert(vect_->size() >= index_); |
|
|
|
assert(vect_->size() >= index_); |
|
|
|
return &(*vect_)[index_]; |
|
|
|
return &(*vect_)[index_]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const_pointer operator->() const { |
|
|
|
|
|
|
|
assert(vect_->size() >= index_); |
|
|
|
|
|
|
|
return &(*vect_)[index_]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// -- Logical Operators
|
|
|
|
// -- Logical Operators
|
|
|
|
bool operator==(const self_type& other) const { |
|
|
|
bool operator==(const self_type& other) const { |
|
|
|
assert(vect_ == other.vect_); |
|
|
|
assert(vect_ == other.vect_); |
|
|
|