Use brace-init instead of make_pair.

This commit is contained in:
John Preston
2026-09-17 08:30:29 +04:00
parent 78789925c6
commit 73f055c44e
6 changed files with 10 additions and 11 deletions

View File

@@ -1841,7 +1841,7 @@ RecentStickerPack &Stickers::getRecentPack() const {
const auto document = owner().document(preloaded.first);
if (!document || !document->sticker()) continue;
recent.push_back(std::make_pair(document, preloaded.second));
recent.push_back({ document, preloaded.second });
}
}
return cRefRecentStickers();

View File

@@ -278,7 +278,7 @@ void _logsWrite(LogDataType type, const QString &msg) {
if (!LogsInMemory) {
LogsInMemory = new LogsInMemoryList;
}
LogsInMemory->push_back(std::make_pair(type, msg));
LogsInMemory->push_back({ type, msg });
} else if (!LogsBeforeSingleInstanceChecked.isEmpty() && type == LogDataMain) {
LogsBeforeSingleInstanceChecked += msg;
}

View File

@@ -1005,7 +1005,7 @@ bool ReadSetting(
}
auto id = Ui::Emoji::IdFromOldKey(oldKey);
if (!id.isEmpty()) {
p.push_back(std::make_pair(id, item.second));
p.push_back({ id, item.second });
}
}
Core::App().settings().setLegacyRecentEmojiPreload(std::move(p));
@@ -1024,7 +1024,7 @@ bool ReadSetting(
for (auto &item : v) {
auto id = Ui::Emoji::IdFromOldKey(item.first);
if (!id.isEmpty()) {
p.push_back(std::make_pair(id, item.second));
p.push_back({ id, item.second });
}
}
Core::App().settings().setLegacyRecentEmojiPreload(std::move(p));

View File

@@ -1417,7 +1417,7 @@ void incrementRecentHashtag(RecentHashtagPack &recent, const QString &tag) {
}
if (i == e) {
while (recent.size() >= 64) recent.pop_back();
recent.push_back(std::make_pair(tag, 1));
recent.push_back({ tag, 1 });
for (i = recent.end() - 1; i != recent.begin(); --i) {
if ((i - 1)->second > i->second) {
break;

View File

@@ -1038,8 +1038,7 @@ void Account::writeSessionSettings(Main::SessionSettings *stored) {
const auto &stickers = _owner->session().data().stickers();
recentStickers.reserve(stickers.getRecentPack().size());
for (const auto &pair : std::as_const(stickers.getRecentPack())) {
recentStickers.push_back(
std::make_pair(pair.first->id, pair.second));
recentStickers.push_back({ pair.first->id, pair.second });
}
}
@@ -2570,7 +2569,7 @@ void Account::importOldRecentStickers() {
if (std::abs(value) > 1
&& (recent.size()
< _owner->session().serverConfig().stickersRecentLimit)) {
recent.push_back(std::make_pair(doc, std::abs(value)));
recent.push_back({ doc, ushort(std::abs(value)) });
}
}
if (def->stickers.isEmpty()) {
@@ -2848,14 +2847,14 @@ void Account::readRecentHashtagsAndBots() {
write.reserve(writeCount);
for (uint32 i = 0; i < writeCount; ++i) {
hashtags.stream >> tag >> count;
write.push_back(std::make_pair(tag.trimmed(), count));
write.push_back({ tag.trimmed(), count });
}
}
if (searchCount) {
search.reserve(searchCount);
for (uint32 i = 0; i < searchCount; ++i) {
hashtags.stream >> tag >> count;
search.push_back(std::make_pair(tag.trimmed(), count));
search.push_back({ tag.trimmed(), count });
}
}
cSetRecentWriteHashtags(write);