Fix issues with stablevector
This commit is contained in:
@@ -261,18 +261,17 @@ namespace OpenVulkano
|
|||||||
|
|
||||||
void PopBack()
|
void PopBack()
|
||||||
{
|
{
|
||||||
if (m_size == 0)
|
if (m_size == 0) return;
|
||||||
{
|
|
||||||
return; // return? or make
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_lastChunk->m_nextIndex == 1 && m_lastChunk != m_firstChunk)
|
if (m_lastChunk->m_nextIndex == 1 && m_lastChunk != m_firstChunk)
|
||||||
{
|
{
|
||||||
VectorChunk* temp = m_lastChunk;
|
VectorChunk* temp = m_lastChunk;
|
||||||
|
m_capacity -= temp->m_capacity;
|
||||||
m_lastChunk = m_lastChunk->m_prev;
|
m_lastChunk = m_lastChunk->m_prev;
|
||||||
m_lastChunk->m_next = nullptr;
|
m_lastChunk->m_next = nullptr;
|
||||||
temp->~VectorChunk();
|
temp->~VectorChunk();
|
||||||
::operator delete(temp);
|
::operator delete(temp);
|
||||||
|
m_size--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,15 +90,13 @@ TEST_CASE("ChunkVector")
|
|||||||
|
|
||||||
REQUIRE(vec.Size() == 100);
|
REQUIRE(vec.Size() == 100);
|
||||||
|
|
||||||
uint64_t tempVal = vec.Capacity();
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < 50; ++i)
|
for (uint32_t i = 0; i < 50; ++i)
|
||||||
{
|
{
|
||||||
vec.PopBack();
|
vec.PopBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
REQUIRE(vec.Size() == 50);
|
REQUIRE(vec.Size() == 50);
|
||||||
REQUIRE(vec.Capacity() == tempVal);
|
REQUIRE(vec.Capacity() == 32 + 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
SECTION("Iterators with empty vector")
|
SECTION("Iterators with empty vector")
|
||||||
|
|||||||
Reference in New Issue
Block a user