VImage: reserve vector before push_back loop

Avoids unnecessary resizes.

Found with clang-tidy's performance-inefficient-vector-operation

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2020-12-13 20:21:34 -08:00
parent 6dd6fafa2a
commit 3f57c0a515

View File

@ -767,6 +767,7 @@ std::vector<VImage>
VImage::bandsplit( VOption *options ) const
{
std::vector<VImage> b;
b.reserve(bands());
for( int i = 0; i < bands(); i++ )
b.push_back( extract_band( i ) );