Skip to content

Commit

Permalink
#5584: Why not letting std::vector use its default growth strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 15, 2021
1 parent 1eb8191 commit 4b4e6b4
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions libs/render/CompactWindingVertexBuffer.h
Expand Up @@ -108,16 +108,12 @@ class CompactWindingVertexBuffer
assert(winding.size() == _size);

const auto currentSize = _vertices.size();
auto position = currentSize / _size;
_vertices.reserve(currentSize + _size); // reserve() never shrinks


std::copy(winding.begin(), winding.end(), std::back_inserter(_vertices));

// Allocate and calculate indices
_indices.reserve(_indices.size() + getNumIndicesPerWinding());

WindingIndexerT::GenerateAndAssignIndices(std::back_inserter(_indices), _size, static_cast<unsigned int>(currentSize));

auto position = currentSize / _size;
return static_cast<Slot>(position);
}

Expand Down

0 comments on commit 4b4e6b4

Please sign in to comment.