clang-tidy: Run modernize-use-emplace everywhere (#6451)

... to avoid constructing and copying temp objects
This commit is contained in:
Levin Oehlmann
2022-06-26 08:54:59 +02:00
committed by GitHub
parent 28ec71f91a
commit c075ba93fb
4 changed files with 7 additions and 7 deletions

View File

@@ -408,7 +408,7 @@ public:
{
char buf[32];
sprintf( buf, "%d", _i );
data.push_back( std::string( buf ) );
data.emplace_back( buf );
return *this;
}
@@ -416,7 +416,7 @@ public:
{
char buf[32];
sprintf( buf, "%f", _f );
data.push_back( std::string( buf ) );
data.emplace_back( buf );
return *this;
}

View File

@@ -157,7 +157,7 @@ bool MidiExport::tryExport(const TrackContainer::TrackList &tracks,
QDomElement it = n.toElement();
int pos = it.attribute("pos", "0").toInt();
int len = it.attribute("len", "0").toInt();
plist.push_back(std::pair<int,int>(pos, pos+len));
plist.emplace_back(pos, pos+len);
}
}
std::sort(plist.begin(), plist.end());

View File

@@ -75,7 +75,7 @@ void Interval::loadSettings(const QDomElement &element)
Scale::Scale() :
m_description(tr("empty"))
{
m_intervals.push_back(Interval(1, 1));
m_intervals.emplace_back(1, 1);
}
Scale::Scale(QString description, std::vector<Interval> intervals) :

View File

@@ -397,7 +397,7 @@ bool MicrotunerConfig::applyScale()
if (!validateScaleForm()) {return false;};
std::vector<Interval> newIntervals;
newIntervals.push_back(Interval(1, 1));
newIntervals.emplace_back(1, 1);
#if (QT_VERSION >= QT_VERSION_CHECK(5,14,0))
QStringList input = m_keymapTextEdit->toPlainText().split('\n', Qt::SkipEmptyParts);
@@ -411,7 +411,7 @@ bool MicrotunerConfig::applyScale()
QString firstSection = line.section(QRegExp("\\s+|/"), 0, 0, QString::SectionSkipEmpty);
if (firstSection.contains('.')) // cent mode
{
newIntervals.push_back(Interval(firstSection.toFloat()));
newIntervals.emplace_back(firstSection.toFloat());
}
else // ratio mode
{
@@ -421,7 +421,7 @@ bool MicrotunerConfig::applyScale()
{
den = line.split('/').at(1).section(QRegExp("\\s+"), 0, 0, QString::SectionSkipEmpty).toInt();
}
newIntervals.push_back(Interval(num, den));
newIntervals.emplace_back(num, den);
}
}