using reserve where possible

This commit is contained in:
Uwe Rathmann 2022-03-25 10:29:12 +01:00
parent 55d5f99575
commit f86e38ef12
2 changed files with 7 additions and 1 deletions

View File

@ -34,9 +34,14 @@ class ListBox : public QskSimpleListBox
private:
void populate()
{
const int count = 10000;
const QString format( "Row %1: The quick brown fox jumps over the lazy dog" );
QStringList entries;
for ( int i = 0; i < 10000; i++ )
entries.reserve( count );
for ( int i = 0; i < count; i++ )
{
entries += format.arg( i + 1 );
}

View File

@ -182,6 +182,7 @@ static inline QskGradientStops qskExtractedStops(
static inline QskGradientStops qskGradientStops( const QGradientStops& qtStops )
{
QskGradientStops stops;
stops.reserve( qtStops.count() );
for ( const auto& s : qtStops )
stops += QskGradientStop( s.first, s.second );