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:
parent
a4e7dea9e3
commit
682bfa2732
10
src/dsc.h
10
src/dsc.h
|
@ -195,6 +195,11 @@ public:
|
||||||
return prev + 1;
|
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() {
|
void ClearTags() {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
|
@ -351,6 +356,11 @@ public:
|
||||||
return prev + 1;
|
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() {
|
void ClearTags() {
|
||||||
int i;
|
int i;
|
||||||
for(i = 0; i < n; i++) {
|
for(i = 0; i < n; i++) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user