Fix Vector (don't init in const functions)

This commit is contained in:
2022-12-08 19:10:42 +01:00
parent ad601e1332
commit b29524aa45
+9 -2
View File
@@ -100,7 +100,9 @@ public:
}
iterator begin() const {
initIfNecessary();
if (buf == nullptr) {
// TODO: Exception
}
return iterator(&buf[0]);
}
@@ -110,7 +112,9 @@ public:
}
iterator end() const {
initIfNecessary();
if (buf == nullptr) {
// TODO: Exception
}
return iterator(&buf[size()]);
}
@@ -228,6 +232,9 @@ public:
return sz;
}
/**
* Calls the constructor of every contained object and sets the size to zero.
*/
void clear() {
while (sz > 0) {
--sz;