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

Use size_type for operator[].

This matches std::vector and is more efficient as it avoids
truncations.

With this the text segment of opt goes from 19705442 bytes
to 19703930 bytes.

llvm-svn: 221973
This commit is contained in:
Rafael Espindola 2014-11-14 07:02:38 +00:00
parent d1ba90ee16
commit 06c17191e1

View File

@ -134,11 +134,11 @@ public:
/// Return a pointer to the vector's buffer, even if empty().
const_pointer data() const { return const_pointer(begin()); }
reference operator[](unsigned idx) {
reference operator[](size_type idx) {
assert(begin() + idx < end());
return begin()[idx];
}
const_reference operator[](unsigned idx) const {
const_reference operator[](size_type idx) const {
assert(begin() + idx < end());
return begin()[idx];
}