We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 88b6248 commit 6f7a4e9Copy full SHA for 6f7a4e9
util/fixed_vector.hh
@@ -3,6 +3,7 @@
3
#include <array>
4
#include <cstddef>
5
#include <iterator>
6
+#include <span>
7
8
template<typename T, size_t MaxElements>
9
class FixedVector {
@@ -48,6 +49,11 @@ public:
48
49
return (num == new_back_idx);
50
}
51
52
+ bool resize_for_overwrite(size_t num) {
53
+ back_idx = std::min(num, MaxElements);
54
+ return (num == back_idx);
55
+ }
56
+
57
// returns MaxElements for failure
58
size_t push_back_for_overwrite() {
59
if (back_idx >= MaxElements)
@@ -138,4 +144,12 @@ public:
138
144
auto end() {
139
145
return begin() + back_idx;
140
146
147
148
+ auto span() {
149
+ return std::span{begin(), back_idx};
150
151
152
+ auto span() const {
153
154
141
155
};
0 commit comments