diff --git a/util/vectorrep.cc b/util/vectorrep.cc index 102c17da2..4e4827aac 100644 --- a/util/vectorrep.cc +++ b/util/vectorrep.cc @@ -178,12 +178,14 @@ bool VectorRep::Iterator::Valid() const { // Returns the key at the current position. // REQUIRES: Valid() const char* VectorRep::Iterator::key() const { + assert(sorted_); return *cit_; } // Advances to the next position. // REQUIRES: Valid() void VectorRep::Iterator::Next() { + assert(sorted_); if (cit_ == bucket_->end()) { return; } @@ -193,6 +195,7 @@ void VectorRep::Iterator::Next() { // Advances to the previous position. // REQUIRES: Valid() void VectorRep::Iterator::Prev() { + assert(sorted_); if (cit_ == bucket_->begin()) { // If you try to go back from the first element, the iterator should be // invalidated. So we set it to past-the-end. This means that you can