feat(vector): revamped vector implementation #1
Loading…
Reference in a new issue
No description provided.
Delete branch "atrecio/fastinahurry:master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Left some minor comments regarding bugs and missing stuff. Thank you for the changes, this is a much needed and overdue makeover.
Let's fix these and I'll clone again to run tests.
@ -19,2 +24,3 @@static Element *_allocate(std::uint64_t alloc_size)T* m_begin{nullptr};T* m_size{0};rename to m_end, pretty please
@ -23,2 +31,2 @@return nullptr;return static_cast<Element *>(::operator new(sizeof(Element) * alloc_size));assert(alloc_size != 0);return static_cast<T*>(::operator new(TSize * alloc_size, TAlign));You're not matching the call to the right operator delete overload, but I'm not sure that matters at all. Might be UB, idk
@ -47,0 +43,4 @@std::destroy_n(m_begin, curr_sz);::operator delete(m_begin);m_begin = new_arr;Missing m_size = curr_sz;
that doesn't do anything you (beautiful person)
@ -47,0 +48,4 @@}constexpr void _allocate_from_empty(std::size_t new_cap = 1) noexcept{Missing m_size = m_begin;
@ -77,1 +81,3 @@::operator delete(p_arr);if(empty()) _allocate_from_empty();else if (m_size == m_cap) _grow_capacity(capacity() * ExpansionMult);return *std::construct_at(m_size++, std::forward<Args>(args)...);we talked about not caring about exception safety, so I'll just make a comment that we're advancing size without knowing if ctor will succeed. Oh well, I'm ok with that
@ -61,2 +69,4 @@constexpr Vector(ReserveInitial<N>) noexcept{_allocate_from_empty(N);}I'm not gonna make you do rule of 5, but could you please add a default ctor? 👉👈
there is one you (beautiful person). but i'm going to add rule of 5 anyways because you're such a (beautiful person).
@ -134,3 +116,3 @@}void shrink_to_fit()constexpr void resize(std::size_t new_cap) noexceptRename to reserve()
reserve and resize do two different things but i'll add reserve anyways you (beautiful person)
@ -143,2 +129,3 @@{m_cap = new_cap;assert(not empty());std::destroy_at(m_size--);We might be destroying past end
for once you're right
@ -0,0 +1,9 @@#include <cstdint>header guard where?
@ -0,0 +1,9 @@#include <cstdint>namespace fiah {extremely pedantic redditor comment: std:: integral types are under cstddef, not cstdint
fix issue below + conflicts and I will merge. thank you
@ -57,0 +64,4 @@constexpr void _free() noexcept{::operator delete(m_begin, TAlign);m_begin = m_end = m_begin = nullptr;🤔
67ade2fe39to648349d295Please ensure title follows conventional commit style
revamped vector and added type flagsto FEAT: (vector, type flags)FEAT: (vector, type flags)to feat(vector): revamped vector implementationLGTM 😛
@ -1,0 +5,4 @@// If C++: Your code is automatically compiled with a precompiled header. //// 99% of includes / packages are already added for you. //// You do NOT need to add your own includes here. //// /////////////////////////////////////////////////////////////////////////this header was removed in my master. Please pull properly
@ -201,3 +209,3 @@};} // namespace fiah<<<<<<< HEADpls remove and solve conflicts properly
@ -204,0 +228,4 @@std::cout << anotherone.use_count() << " ";}>>>>>>> 0256ede (added header guards where missing, updated /fixed vector issues)oof
ty