// #pragma once // #include // #include // #include "commons/commons_array.h" // #include "commons/commons_base.h" // #include "commons/commons_inline_vec_def.h" // #include "commons/commons_mem.h" // #include "commons/commons_span.h" // template // [[nodiscard]] // INLINE auto inline_vec::operator[](uint64_t i) -> T& // { // DASSERT(i < size); // return data[i]; // } // template // [[nodiscard]] // INLINE auto inline_vec::operator[](uint64_t i) const -> const T& // { // DASSERT(i < size); // return data[i]; // } // template // [[nodiscard]] // INLINE auto InlineVec_Capacity(inline_vec& self) -> uint64_t // { // return VecCapacity; // } // template // [[nodiscard]] // INLINE auto InlineVec_Size(inline_vec& self) -> uint64_t // { // return self.size; // } // template // [[nodiscard]] // INLINE auto InlineVec_DataPtr(inline_vec& self) -> T* // { // return self.data.data; // } // template // [[nodiscard]] // INLINE auto InlineVec_AsSpan(inline_vec& self) -> span // { // return span { self.data.data, self.size }; // } // template // [[nodiscard]] // INLINE auto InlineVec_AsSpan(const inline_vec& self) -> span // { // return span { self.data.data, self.size }; // } // template // [[nodiscard]] // INLINE auto InlineVec_Front(inline_vec& self) -> T& // { // DASSERT(self.size); // return self[0]; // } // template // [[nodiscard]] // INLINE auto InlineVec_Front(const inline_vec& self) -> const T& // { // DASSERT(self.size); // return self[0]; // } // template // [[nodiscard]] // INLINE auto InlineVec_Back(inline_vec& self) -> T& // { // DASSERT(self.size); // return self[self.size - 1]; // } // template // [[nodiscard]] // INLINE auto InlineVec_Back(const inline_vec& self) -> const T& // { // DASSERT(self.size); // return self[self.size - 1]; // } // template // INLINE void InlineVec_Resize(inline_vec& self, uint64_t newSize) // { // DASSERT(newSize <= Capacity); // self.size = newSize; // } // template // INLINE void InlineVec_Clear(inline_vec& self) // { // self.size = 0; // } // template // INLINE auto InlineVec_Append(inline_vec& self) -> T& // { // DASSERT(self.size < Capacity); // T* p = self.data.data + self.size++; // return *p; // } // template // INLINE auto InlineVec_Append(inline_vec& self, const D& data) -> T& // requires(std::is_convertible_v) // { // T& ret = InlineVec_Append(self); // ret = data; // return ret; // } // template // INLINE void InlineVec_Append(inline_vec& self, span data) // { // DASSERT(self.size + data.size <= Capacity); // MemCpy(self.data.data + self.size, data.data, Span_SizeBytes(data)); // self.size += data.size; // } // template // INLINE auto InlineVec_PopBack(inline_vec& self) -> T // { // T ret = InlineVec_Back(self); // --self.size; // return ret; // } // template // [[nodiscard]] // INLINE auto InlineVec_Find(inline_vec& self, const T& val) -> T* // { // for (auto& elem : self) { // if (elem == val) // return &elem; // } // return nullptr; // } // template // INLINE void InlineVec_Erase(inline_vec& self, T* pos) // { // span s = Span_Erase(InlineVec_AsSpan(self), pos); // self.size = s.size; // } // template // INLINE auto InlineVec_Insert(inline_vec& self, uint64_t index, const T& val) -> T* // { // DASSERT(self.size < Capacity); // DASSERT(index <= self.size); // MemMove(self.data.data + index + 1, self.data.data + index, (self.size - index) * sizeof(T)); // self.data.data[index] = val; // ++self.size; // return self.data.data + index; // } // template // INLINE auto InlineVec_Index(inline_vec& self, T* p) -> uint64_t // { // uint64_t index = p - self.data.data; // DASSERT(index < self.size); // return index; // }