Skip to content

Commit

Permalink
[ADT][NFC] Use size_t type for index in indexed_accessor_range
Browse files Browse the repository at this point in the history
It makes it consistent with `size()` method return type and with
STL-like containers API.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D97921
  • Loading branch information
Vladislav Vinogradov committed Mar 10, 2021
1 parent ea8e5b8 commit dc8446c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/include/llvm/ADT/STLExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -1114,9 +1114,9 @@ class indexed_accessor_range_base {

iterator begin() const { return iterator(base, 0); }
iterator end() const { return iterator(base, count); }
ReferenceT operator[](unsigned index) const {
assert(index < size() && "invalid index for value range");
return DerivedT::dereference_iterator(base, index);
ReferenceT operator[](size_t Index) const {
assert(Index < size() && "invalid index for value range");
return DerivedT::dereference_iterator(base, static_cast<ptrdiff_t>(Index));
}
ReferenceT front() const {
assert(!empty() && "expected non-empty range");
Expand Down

0 comments on commit dc8446c

Please sign in to comment.