Add STL begin()/end() functions to List and IdList.

This will allow us to use it in the C++11 foreach loop, as well
as simplify use of STL <algorithms>.
This commit is contained in:
whitequark 2016-05-29 14:14:38 +00:00
parent a4e7dea9e3
commit 682bfa2732

View File

@ -195,6 +195,11 @@ public:
return prev + 1;
}
T *begin() { return &elem[0]; }
T *end() { return &elem[n]; }
const T *begin() const { return &elem[0]; }
const T *end() const { return &elem[n]; }
void ClearTags() {
int i;
for(i = 0; i < n; i++) {
@ -351,6 +356,11 @@ public:
return prev + 1;
}
T *begin() { return &elem[0]; }
T *end() { return &elem[n]; }
const T *begin() const { return &elem[0]; }
const T *end() const { return &elem[n]; }
void ClearTags() {
int i;
for(i = 0; i < n; i++) {