aboutsummaryrefslogtreecommitdiffstats
path: root/include/api-test/freelist.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'include/api-test/freelist.hpp')
-rw-r--r--include/api-test/freelist.hpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/include/api-test/freelist.hpp b/include/api-test/freelist.hpp
index b231d9a..cfe8903 100644
--- a/include/api-test/freelist.hpp
+++ b/include/api-test/freelist.hpp
@@ -1,6 +1,7 @@
+#pragma once
#include <numeric>
#include <vector>
-
+#include <cassert>
static constexpr uint32_t default_element_count = 1024U;
@@ -27,6 +28,11 @@ class freelist {
}
T& operator[](uint32_t index) {
+ assert(index >= 0);
+ return items[index];
+ }
+
+ const T& operator[](uint32_t index) const {
return items[index];
}
@@ -41,11 +47,11 @@ class freelist {
return invalid_id;
}
- auto begin() {
+ auto begin() const {
return items.begin();
}
- auto end() {
+ auto end() const {
return items.end();
}