mirror of
https://github.com/LMMS/lmms.git
synced 2026-05-19 12:16:16 -04:00
Prefer emplace_back; take argument by value.
We copy the QString, so it makes sense to accept it by value and _move_ it into the collection instead. This causes the caller to move any rvalue QString into the function, and then the QString is never actually copied at all.
This commit is contained in:
@@ -27,9 +27,9 @@
|
||||
|
||||
|
||||
|
||||
void ComboBoxModel::addItem( const QString& item, std::unique_ptr<PixmapLoader> loader )
|
||||
void ComboBoxModel::addItem( QString item, std::unique_ptr<PixmapLoader> loader )
|
||||
{
|
||||
m_items.push_back( std::make_pair( item, std::move(loader) ) );
|
||||
m_items.emplace_back( std::move(item), std::move(loader) );
|
||||
setRange( 0, m_items.size() - 1 );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user