Skip to content

Commit

Permalink
remove unnecessary member
Browse files Browse the repository at this point in the history
  • Loading branch information
dc03 committed Jun 15, 2023
1 parent 6ee594b commit 73cacbd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions llvm/include/llvm/ADT/IndexedMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,20 @@ template <typename T, typename ToIndexT = identity<unsigned>>

StorageT storage_;
T nullVal_;
ToIndexT toIndex_;

public:
IndexedMap() : nullVal_(T()) {}

explicit IndexedMap(const T& val) : nullVal_(val) {}

typename StorageT::reference operator[](IndexT n) {
assert(toIndex_(n) < storage_.size() && "index out of bounds!");
return storage_[toIndex_(n)];
assert(ToIndexT()(n) < storage_.size() && "index out of bounds!");
return storage_[ToIndexT()(n)];
}

typename StorageT::const_reference operator[](IndexT n) const {
assert(toIndex_(n) < storage_.size() && "index out of bounds!");
return storage_[toIndex_(n)];
assert(ToIndexT()(n) < storage_.size() && "index out of bounds!");
return storage_[ToIndexT()(n)];
}

void reserve(typename StorageT::size_type s) {
Expand All @@ -66,13 +65,13 @@ template <typename T, typename ToIndexT = identity<unsigned>>
}

void grow(IndexT n) {
unsigned NewSize = toIndex_(n) + 1;
unsigned NewSize = ToIndexT()(n) + 1;
if (NewSize > storage_.size())
resize(NewSize);
}

bool inBounds(IndexT n) const {
return toIndex_(n) < storage_.size();
return ToIndexT()(n) < storage_.size();
}

typename StorageT::size_type size() const {
Expand Down

0 comments on commit 73cacbd

Please sign in to comment.