Fix the constness issues around autovector::iterator_impl's dereference operators (#6057)
Summary: As described in detail in issue https://github.com/facebook/rocksdb/issues/6048, iterators' dereference operators (`*`, `->`, and `[]`) should return `pointer`s/`reference`s (as opposed to `const_pointer`s/`const_reference`s) even if the iterator itself is `const` to be in sync with the standard's iterator concept. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6057 Test Plan: make check Differential Revision: D18623235 Pulled By: ltamasi fbshipit-source-id: 04e82d73bc0c67fb0ded018383af8dfc332050cc
This commit is contained in:
parent
d8c28e692a
commit
75dfc7883d
@ -120,35 +120,20 @@ class autovector {
|
||||
}
|
||||
|
||||
// -- Reference
|
||||
reference operator*() {
|
||||
reference operator*() const {
|
||||
assert(vect_->size() >= index_);
|
||||
return (*vect_)[index_];
|
||||
}
|
||||
|
||||
const_reference operator*() const {
|
||||
assert(vect_->size() >= index_);
|
||||
return (*vect_)[index_];
|
||||
}
|
||||
|
||||
pointer operator->() {
|
||||
pointer operator->() const {
|
||||
assert(vect_->size() >= index_);
|
||||
return &(*vect_)[index_];
|
||||
}
|
||||
|
||||
const_pointer operator->() const {
|
||||
assert(vect_->size() >= index_);
|
||||
return &(*vect_)[index_];
|
||||
}
|
||||
|
||||
reference operator[](difference_type len) {
|
||||
reference operator[](difference_type len) const {
|
||||
return *(*this + len);
|
||||
}
|
||||
|
||||
const_reference operator[](difference_type len) const {
|
||||
return *(*this + len);
|
||||
}
|
||||
|
||||
|
||||
// -- Logical Operators
|
||||
bool operator==(const self_type& other) const {
|
||||
assert(vect_ == other.vect_);
|
||||
|
Loading…
x
Reference in New Issue
Block a user