reserve to speed up allocation

This commit is contained in:
Sébastien Loriot 2012-05-14 12:07:34 +00:00
parent 79affebe42
commit 21cf39655e
1 changed files with 1 additions and 0 deletions

View File

@ -402,6 +402,7 @@ public:
// iterate over primitives to get reference points on them // iterate over primitives to get reference points on them
std::vector<Point_and_primitive_id> points; std::vector<Point_and_primitive_id> points;
points.reserve(m_primitives.size());
typename Primitives::const_iterator it; typename Primitives::const_iterator it;
for(it = m_primitives.begin(); it != m_primitives.end(); ++it) for(it = m_primitives.begin(); it != m_primitives.end(); ++it)
points.push_back(Point_and_primitive_id(it->reference_point(), it->id())); points.push_back(Point_and_primitive_id(it->reference_point(), it->id()));