1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Add front/back accessors to indexed_accessor_range.

These map to the similar accessors on ArrayRef and other random access containers.

This fixes a compilation error on MLIR ODS for variadic operands/results, which relied on the availability of front in certain situations.
This commit is contained in:
River Riddle 2020-06-29 22:37:05 -07:00
parent c1e656184f
commit 986143ca63

View File

@ -1121,6 +1121,14 @@ public:
assert(index < size() && "invalid index for value range");
return DerivedT::dereference_iterator(base, index);
}
ReferenceT front() const {
assert(!empty() && "expected non-empty range");
return (*this)[0];
}
ReferenceT back() const {
assert(!empty() && "expected non-empty range");
return (*this)[size() - 1];
}
/// Compare this range with another.
template <typename OtherT> bool operator==(const OtherT &other) const {