mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-13 15:01:49 +00:00
fix stack_vector
This commit is contained in:
parent
295fba467e
commit
1fbf16e3dc
1 changed files with 4 additions and 2 deletions
|
|
@ -6,7 +6,7 @@ namespace util {
|
||||||
template<typename T, int capacity>
|
template<typename T, int capacity>
|
||||||
class stack_vector {
|
class stack_vector {
|
||||||
struct buffer {
|
struct buffer {
|
||||||
alignas(alignof(T)) char* data[sizeof(T) * capacity];
|
alignas(alignof(T)) char data[sizeof(T) * capacity];
|
||||||
|
|
||||||
T* ptr() {
|
T* ptr() {
|
||||||
return reinterpret_cast<T*>(data);
|
return reinterpret_cast<T*>(data);
|
||||||
|
|
@ -43,7 +43,9 @@ namespace util {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~stack_vector() = default;
|
~stack_vector() {
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
void push_back(const T& value) {
|
void push_back(const T& value) {
|
||||||
if (size_ < capacity) {
|
if (size_ < capacity) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue