Skip to content

Commit

Permalink
Reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 10, 2022
1 parent 687bc99 commit 286f79e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/pal/problem.cpp
Expand Up @@ -653,6 +653,7 @@ void Problem::chain_search()
QList<LabelPosition *> Problem::getSolution( bool returnInactive, QList<LabelPosition *> *unlabeled )
{
QList<LabelPosition *> finalLabelPlacements;
finalLabelPlacements.reserve( mFeatureCount );

// loop through all features to be labeled
for ( std::size_t i = 0; i < mFeatureCount; i++ )
Expand Down Expand Up @@ -684,6 +685,7 @@ QList<LabelPosition *> Problem::getSolution( bool returnInactive, QList<LabelPos
// unlabeled features also include those with no candidates
if ( unlabeled )
{
unlabeled->reserve( mPositionsWithNoCandidates.size() );
for ( const std::unique_ptr< LabelPosition > &position : mPositionsWithNoCandidates )
unlabeled->append( position.get() );
}
Expand Down

0 comments on commit 286f79e

Please sign in to comment.