Fix Vector (don't init in const functions)
This commit is contained in:
@ -100,7 +100,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
iterator begin() const {
|
iterator begin() const {
|
||||||
initIfNecessary();
|
if (buf == nullptr) {
|
||||||
|
// TODO: Exception
|
||||||
|
}
|
||||||
return iterator(&buf[0]);
|
return iterator(&buf[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +112,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
iterator end() const {
|
iterator end() const {
|
||||||
initIfNecessary();
|
if (buf == nullptr) {
|
||||||
|
// TODO: Exception
|
||||||
|
}
|
||||||
return iterator(&buf[size()]);
|
return iterator(&buf[size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,6 +232,9 @@ public:
|
|||||||
return sz;
|
return sz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calls the constructor of every contained object and sets the size to zero.
|
||||||
|
*/
|
||||||
void clear() {
|
void clear() {
|
||||||
while (sz > 0) {
|
while (sz > 0) {
|
||||||
--sz;
|
--sz;
|
||||||
|
Reference in New Issue
Block a user