Address MS Visual Studio 2017 issue with autovector

Summary:
This addresses https://github.com/facebook/rocksdb/issues/2262
Closes https://github.com/facebook/rocksdb/pull/2333

Differential Revision: D5097941

Pulled By: siying

fbshipit-source-id: fb33582bfe7883ecc3f6da028703982522b5f75f
main
Dmitri Smirnov 8 years ago committed by Facebook Github Bot
parent 88c818e437
commit 15ba4d6c4b
  1. 18
      util/autovector.h

@ -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_);

Loading…
Cancel
Save