Skip to content

Commit 1196475

Browse files
committed
fix: add constant iters to hybrid vector
1 parent 35b9a16 commit 1196475

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

include/plg/hybrid_vector.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,14 @@ namespace plg {
307307
return plg::visit([](auto&& vec) { return vec.end(); }, self.storage_);
308308
}
309309

310+
[[nodiscard]] constexpr auto cbegin(this auto&& self) {
311+
return plg::visit([](auto&& vec) { return vec.cbegin(); }, self.storage_);
312+
}
313+
314+
[[nodiscard]] constexpr auto cend(this auto&& self) {
315+
return plg::visit([](auto&& vec) { return vec.cend(); }, self.storage_);
316+
}
317+
310318
// Range support (C++23)
311319
[[nodiscard]] friend constexpr auto begin(hybrid_vector& v) {
312320
return v.begin();
@@ -315,5 +323,13 @@ namespace plg {
315323
[[nodiscard]] friend constexpr auto end(hybrid_vector& v) {
316324
return v.end();
317325
}
326+
327+
[[nodiscard]] friend constexpr auto cbegin(hybrid_vector& v) {
328+
return v.cbegin();
329+
}
330+
331+
[[nodiscard]] friend constexpr auto cend(hybrid_vector& v) {
332+
return v.cend();
333+
}
318334
};
319335
}

0 commit comments

Comments
 (0)