diff --git a/src/compactvector.h b/src/compactvector.h index 65a40f114..8f9e8e74e 100644 --- a/src/compactvector.h +++ b/src/compactvector.h @@ -12,10 +12,17 @@ * *************************************************/ +<<<<<<< HEAD template class compactvector { static_assert(MEMMOVE_SAFE || std::is_trivially_copyable::value, "compactvector requires trivially copyable types"); +======= +template +class compactvector +{ + static_assert(std::is_trivially_copyable::value, "compactvector requires trivially copyable types"); +>>>>>>> New expire datastructure and algorithm. Allows us to expire in sublinear time T *m_data = nullptr; unsigned m_celem = 0; unsigned m_max = 0; @@ -26,7 +33,10 @@ public: compactvector() noexcept = default; ~compactvector() noexcept { +<<<<<<< HEAD clear(); // call dtors +======= +>>>>>>> New expire datastructure and algorithm. Allows us to expire in sublinear time zfree(m_data); } @@ -78,7 +88,11 @@ public: assert(idx < m_max); where = m_data + idx; memmove(m_data + idx + 1, m_data + idx, (m_celem - idx)*sizeof(T)); +<<<<<<< HEAD new(m_data + idx) T(std::move(val)); +======= + m_data[idx] = val; +>>>>>>> New expire datastructure and algorithm. Allows us to expire in sublinear time ++m_celem; return where; } @@ -102,7 +116,10 @@ public: assert(where >= m_data); size_t idx = where - m_data; assert(idx < m_celem); +<<<<<<< HEAD where->~T(); +======= +>>>>>>> New expire datastructure and algorithm. Allows us to expire in sublinear time memmove(where, where+1, ((m_celem - idx - 1)*sizeof(T))); --m_celem; @@ -129,8 +146,11 @@ public: void clear() { +<<<<<<< HEAD for (size_t idx = 0; idx < m_celem; ++idx) m_data[idx].~T(); +======= +>>>>>>> New expire datastructure and algorithm. Allows us to expire in sublinear time zfree(m_data); m_data = nullptr; m_celem = 0; diff --git a/src/object.cpp b/src/object.cpp index 900a9058c..ce6265ad1 100644 --- a/src/object.cpp +++ b/src/object.cpp @@ -1490,4 +1490,4 @@ void redisObject::setrefcount(unsigned ref) { serverAssert(!FExpires()); refcount.store(ref, std::memory_order_relaxed); -} \ No newline at end of file +}