Fix undefined behavior in IdList::end().

pull/487/head
Ryan Pavlik 2019-09-09 17:20:28 -05:00 committed by whitequark
parent ec13839c92
commit b1e280e75f
1 changed files with 2 additions and 2 deletions

View File

@ -474,9 +474,9 @@ public:
T const &operator[](size_t i) const { return Get(i); } T const &operator[](size_t i) const { return Get(i); }
T *begin() { return IsEmpty() ? nullptr : &elem[0]; } T *begin() { return IsEmpty() ? nullptr : &elem[0]; }
T *end() { return IsEmpty() ? nullptr : &elem[n]; } T *end() { return IsEmpty() ? nullptr : &elem[0] + n; }
const T *begin() const { return IsEmpty() ? nullptr : &elem[0]; } const T *begin() const { return IsEmpty() ? nullptr : &elem[0]; }
const T *end() const { return IsEmpty() ? nullptr : &elem[n]; } const T *end() const { return IsEmpty() ? nullptr : &elem[0] + n; }
const T *cbegin() const { return begin(); } const T *cbegin() const { return begin(); }
const T *cend() const { return end(); } const T *cend() const { return end(); }