diff --git a/Telegram/SourceFiles/boxes/auto_download_box.cpp b/Telegram/SourceFiles/boxes/auto_download_box.cpp index ae42f3cc8..3617a9eb6 100644 --- a/Telegram/SourceFiles/boxes/auto_download_box.cpp +++ b/Telegram/SourceFiles/boxes/auto_download_box.cpp @@ -162,7 +162,7 @@ void AutoDownloadBox::setupContent() { *downloadValues, *autoPlayValues); auto allowMore = values | ranges::views::filter([&](Pair pair) { - const auto [type, enabled] = pair; + const auto &[type, enabled] = pair; const auto value = enabled ? limitByType(type) : 0; const auto old = settings->bytesLimit(_source, type); return (old < value); @@ -170,7 +170,7 @@ void AutoDownloadBox::setupContent() { return pair.first; }); const auto less = ranges::any_of(*autoPlayValues, [&](Pair pair) { - const auto [type, enabled] = pair; + const auto &[type, enabled] = pair; const auto value = enabled ? limitByType(type) : 0; return value < settings->bytesLimit(_source, type); }); @@ -179,7 +179,7 @@ void AutoDownloadBox::setupContent() { allowMore.end()); const auto changed = ranges::any_of(values, [&](Pair pair) { - const auto [type, enabled] = pair; + const auto &[type, enabled] = pair; const auto value = enabled ? limitByType(type) : 0; return value != settings->bytesLimit(_source, type); }); diff --git a/Telegram/SourceFiles/boxes/connection_box.cpp b/Telegram/SourceFiles/boxes/connection_box.cpp index 3bdaa932d..4403f56fa 100644 --- a/Telegram/SourceFiles/boxes/connection_box.cpp +++ b/Telegram/SourceFiles/boxes/connection_box.cpp @@ -748,7 +748,7 @@ void ProxiesBox::applyView(View &&view) { const auto wrap = _wrap ? _wrap.data() : _initialWrap.data(); - const auto [i, ok] = _rows.emplace(id, nullptr); + const auto &[i, ok] = _rows.emplace(id, nullptr); i->second.reset(wrap->insert( 0, object_ptr( diff --git a/Telegram/SourceFiles/boxes/language_box.cpp b/Telegram/SourceFiles/boxes/language_box.cpp index ab709a87d..aa69a6fee 100644 --- a/Telegram/SourceFiles/boxes/language_box.cpp +++ b/Telegram/SourceFiles/boxes/language_box.cpp @@ -1121,7 +1121,7 @@ void LanguageBox::prepare() { using namespace rpl::mappers; - const auto [recent, official] = PrepareLists(); + const auto &[recent, official] = PrepareLists(); const auto inner = setInnerWidget( object_ptr(this, recent, official), st::boxScroll, diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index d1b3dbb37..007355317 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -882,7 +882,7 @@ auto ShareBox::Inner::getChat(not_null row) row->attached = i->second.get(); return i->second.get(); } - const auto [i, ok] = _dataMap.emplace( + const auto &[i, ok] = _dataMap.emplace( peer, std::make_unique(peer, _st.item, [=] { repaintChat(peer); })); updateChatName(i->second.get()); diff --git a/Telegram/SourceFiles/calls/group/calls_group_call.cpp b/Telegram/SourceFiles/calls/group/calls_group_call.cpp index 49dd3db91..5ec38443d 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_call.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_call.cpp @@ -3013,7 +3013,7 @@ void GroupCall::checkLastSpoke() { const auto now = crl::now(); auto list = base::take(_lastSpoke); for (auto i = list.begin(); i != list.end();) { - const auto [ssrc, when] = *i; + const auto &[ssrc, when] = *i; if (when.anything + kKeepInListFor >= now) { hasRecent = true; ++i; diff --git a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp index 7c6ae96c8..fed24fc5b 100644 --- a/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp +++ b/Telegram/SourceFiles/chat_helpers/emoji_sets_manager.cpp @@ -247,7 +247,7 @@ void Row::paintPreview(QPainter &p) const { const auto width = st::manageEmojiPreviewWidth; const auto height = st::manageEmojiPreviewWidth; auto &&preview = ranges::views::zip(_preview, ranges::views::ints(0, int(_preview.size()))); - for (const auto [pixmap, index] : preview) { + for (const auto &[pixmap, index] : preview) { const auto row = (index / 2); const auto column = (index % 2); const auto left = x + (column ? width - st::manageEmojiPreview : 0); diff --git a/Telegram/SourceFiles/core/core_cloud_password.cpp b/Telegram/SourceFiles/core/core_cloud_password.cpp index 99b5d589e..3a65f24d5 100644 --- a/Telegram/SourceFiles/core/core_cloud_password.cpp +++ b/Telegram/SourceFiles/core/core_cloud_password.cpp @@ -128,7 +128,7 @@ CloudPasswordResult ComputeCheck( } }; - const auto [a, AForHash, u] = GenerateAndCheckRandom(); + const auto &[a, AForHash, u] = GenerateAndCheckRandom(); const auto g_b = BigNum::ModSub(B, kg_x, p, context); if (!MTP::IsGoodModExpFirst(g_b, p)) { LOG(("API Error: Bad g_b in cloud password check!")); diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 2d10ad484..ad4a79eb7 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -402,7 +402,7 @@ void Manager::fillDefaults() { kShowFolder, ranges::views::ints(1, ranges::unreachable)); - for (const auto [command, index] : folders) { + for (const auto &[command, index] : folders) { set(u"%1+%2"_q.arg(ctrl).arg(index), command); } @@ -410,7 +410,7 @@ void Manager::fillDefaults() { kShowAccount, ranges::views::ints(1, ranges::unreachable)); - for (const auto [command, index] : accounts) { + for (const auto &[command, index] : accounts) { set(u"%1+shift+%2"_q.arg(ctrl).arg(index), command); } diff --git a/Telegram/SourceFiles/data/data_changes.cpp b/Telegram/SourceFiles/data/data_changes.cpp index f20041565..773c50d5d 100644 --- a/Telegram/SourceFiles/data/data_changes.cpp +++ b/Telegram/SourceFiles/data/data_changes.cpp @@ -56,7 +56,7 @@ rpl::producer Changes::Manager::updates( Flags flags) const { return _stream.events( ) | rpl::filter([=](const UpdateType &update) { - const auto [updateData, updateFlags] = update; + const auto &[updateData, updateFlags] = update; return (updateData == data) && (updateFlags & flags); }); } diff --git a/Telegram/SourceFiles/data/data_group_call.cpp b/Telegram/SourceFiles/data/data_group_call.cpp index 0567477c4..72b4d387f 100644 --- a/Telegram/SourceFiles/data/data_group_call.cpp +++ b/Telegram/SourceFiles/data/data_group_call.cpp @@ -847,7 +847,7 @@ void GroupCall::requestUnknownParticipants() { auto result = base::flat_map(); result.reserve(kRequestPerPage); while (result.size() < kRequestPerPage) { - const auto [ssrc, when] = _unknownSpokenSsrcs.back(); + const auto &[ssrc, when] = _unknownSpokenSsrcs.back(); result.emplace(ssrc, when); _unknownSpokenSsrcs.erase(_unknownSpokenSsrcs.end() - 1); } @@ -863,7 +863,7 @@ void GroupCall::requestUnknownParticipants() { result.reserve(available); while (result.size() < available) { const auto &back = _unknownSpokenPeerIds.back(); - const auto [participantPeerId, when] = back; + const auto &[participantPeerId, when] = back; result.emplace(participantPeerId, when); _unknownSpokenPeerIds.erase(_unknownSpokenPeerIds.end() - 1); } diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index dd5b435ee..b171cf0f4 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -123,7 +123,7 @@ not_null Histories::findOrCreate(PeerId peerId) { if (const auto result = find(peerId)) { return result; } - const auto [i, ok] = _map.emplace( + const auto &[i, ok] = _map.emplace( peerId, std::make_unique(&owner(), peerId)); return i->second.get(); @@ -355,7 +355,7 @@ void Histories::requestDialogEntry( return; } - const auto [j, ok] = _dialogRequestsPending.try_emplace(history); + const auto &[j, ok] = _dialogRequestsPending.try_emplace(history); if (callback) { j->second.push_back(std::move(callback)); } @@ -1130,7 +1130,7 @@ void Histories::finishSentRequest( if (state->postponedRequestEntry && !postponeEntryRequest(*state)) { const auto i = _dialogRequests.find(history); Assert(i != end(_dialogRequests)); - const auto [j, ok] = _dialogRequestsPending.emplace( + const auto &[j, ok] = _dialogRequestsPending.emplace( history, std::move(i->second)); Assert(ok); diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 6001a46c2..de0a3c62d 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -1097,7 +1097,7 @@ void Session::watchForOffline(not_null user, TimeId now) { return; } const auto till = user->onlineTill; - const auto [i, ok] = _watchingForOffline.emplace(user, till); + const auto &[i, ok] = _watchingForOffline.emplace(user, till); if (!ok) { if (i->second == till) { return; @@ -1626,7 +1626,7 @@ HistoryItem *Session::changeMessageId(PeerId peerId, MsgId wasId, MsgId nowId) { } const auto item = i->second; list->erase(i); - const auto [j, ok] = list->emplace(nowId, item); + const auto &[j, ok] = list->emplace(nowId, item); if (!peerIsChannel(peerId)) { if (IsServerMsgId(wasId)) { @@ -1789,7 +1789,7 @@ void Session::registerHighlightProcess( not_null item) { Expects(item->inHighlightProcess()); - const auto [i, ok] = _highlightings.emplace(processId, item); + const auto &[i, ok] = _highlightings.emplace(processId, item); Ensures(ok); } @@ -4208,7 +4208,7 @@ not_null Session::folder(FolderId id) { if (const auto result = folderLoaded(id)) { return result; } - const auto [it, ok] = _folders.emplace( + const auto &[it, ok] = _folders.emplace( id, std::make_unique(this, id)); return it->second.get(); diff --git a/Telegram/SourceFiles/data/data_stories.cpp b/Telegram/SourceFiles/data/data_stories.cpp index abf9227fd..a35279be4 100644 --- a/Telegram/SourceFiles/data/data_stories.cpp +++ b/Telegram/SourceFiles/data/data_stories.cpp @@ -234,7 +234,7 @@ Story *Stories::applySingle(PeerId peerId, const MTPstoryItem &story) { void Stories::requestPeerStories( not_null peer, Fn done) { - const auto [i, ok] = _requestingPeerStories.emplace(peer); + const auto &[i, ok] = _requestingPeerStories.emplace(peer); if (done) { i->second.push_back(std::move(done)); } diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index d7d17a37c..05e54ec6b 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -2458,7 +2458,7 @@ void InnerWidget::appendToFiltered(Key key) { } auto row = std::make_unique(key, 0, 0); row->recountHeight(_narrowRatio); - const auto [i, ok] = _filterResultsGlobal.emplace(key, std::move(row)); + const auto &[i, ok] = _filterResultsGlobal.emplace(key, std::move(row)); const auto height = filteredHeight(); _filterResults.emplace_back(i->second.get()); _filterResults.back().top = height; @@ -3913,7 +3913,7 @@ void InnerWidget::setupShortcuts() { auto &&folders = ranges::views::zip( Shortcuts::kShowFolder, ranges::views::ints(0, ranges::unreachable)); - for (const auto [command, index] : folders) { + for (const auto &[command, index] : folders) { const auto select = (command == Command::ShowFolderLast) ? (filtersCount - 1) : std::clamp(index, 0, filtersCount - 1); @@ -3940,7 +3940,7 @@ void InnerWidget::setupShortcuts() { auto &&pinned = ranges::views::zip( kPinned, ranges::views::ints(0, ranges::unreachable)); - for (const auto [command, index] : pinned) { + for (const auto &[command, index] : pinned) { request->check(command) && request->handle([=, index = index] { const auto list = (_filterId ? session().data().chatsFilters().chatsList(_filterId) diff --git a/Telegram/SourceFiles/editor/editor_crop.cpp b/Telegram/SourceFiles/editor/editor_crop.cpp index 78a91aa6a..54f8369c2 100644 --- a/Telegram/SourceFiles/editor/editor_crop.cpp +++ b/Telegram/SourceFiles/editor/editor_crop.cpp @@ -212,8 +212,8 @@ void Crop::computeDownState(const QPoint &p) { const auto edge = mouseState(p); const auto &inner = _innerRect; const auto &crop = _cropPaint; - const auto [iLeft, iTop, iRight, iBottom] = RectEdges(inner); - const auto [cLeft, cTop, cRight, cBottom] = RectEdges(crop); + const auto &[iLeft, iTop, iRight, iBottom] = RectEdges(inner); + const auto &[cLeft, cTop, cRight, cBottom] = RectEdges(crop); _down = InfoAtDown{ .rect = crop, .edge = edge, diff --git a/Telegram/SourceFiles/export/export_api_wrap.cpp b/Telegram/SourceFiles/export/export_api_wrap.cpp index 25fe29a71..b23329c03 100644 --- a/Telegram/SourceFiles/export/export_api_wrap.cpp +++ b/Telegram/SourceFiles/export/export_api_wrap.cpp @@ -1553,7 +1553,7 @@ void ApiWrap::appendChatsSlice( continue; } } - const auto [i, ok] = process.indexByPeer.emplace( + const auto &[i, ok] = process.indexByPeer.emplace( info.peerId, nextIndex); if (ok) { diff --git a/Telegram/SourceFiles/export/output/export_output_html.cpp b/Telegram/SourceFiles/export/output/export_output_html.cpp index 3f0b03eaf..c543de8a5 100644 --- a/Telegram/SourceFiles/export/output/export_output_html.cpp +++ b/Telegram/SourceFiles/export/output/export_output_html.cpp @@ -1563,7 +1563,7 @@ QByteArray HtmlWriter::Wrap::pushStickerMedia( const QString &basePath) { using namespace Data; - const auto [thumb, size] = WriteImageThumb( + const auto &[thumb, size] = WriteImageThumb( basePath, data.file.relativePath, CalculateThumbSize( @@ -1730,7 +1730,7 @@ QByteArray HtmlWriter::Wrap::pushPhotoMedia( const QString &basePath) { using namespace Data; - const auto [thumb, size] = WriteImageThumb( + const auto &[thumb, size] = WriteImageThumb( basePath, data.image.file.relativePath, CalculateThumbSize( @@ -2790,7 +2790,7 @@ Result HtmlWriter::writeDialogSlice(const Data::MessagesSlice &data) { _settings.path, FormatDateText(date))); } - const auto [info, content] = _chat->pushMessage( + const auto &[info, content] = _chat->pushMessage( message, previous, _dialog, diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index bdc0d659c..f5a9765c0 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -465,7 +465,7 @@ not_null History::insertItem( std::unique_ptr item) { Expects(item != nullptr); - const auto [i, ok] = _messages.insert(std::move(item)); + const auto &[i, ok] = _messages.insert(std::move(item)); const auto result = i->get(); owner().registerMessage(result); diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index c824976cf..9cf3ab373 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -1992,7 +1992,7 @@ void HistoryInner::mouseActionFinish( && !_selected.empty() && _selected.cbegin()->second != FullSelection && !hasCopyRestriction(_selected.cbegin()->first)) { - const auto [item, selection] = *_selected.cbegin(); + const auto &[item, selection] = *_selected.cbegin(); if (const auto view = viewByItem(item)) { TextUtilities::SetClipboardText( view->selectedText(selection), @@ -2925,7 +2925,7 @@ TextForMimeData HistoryInner::getSelectedText() const { return TextForMimeData(); } if (selected.cbegin()->second != FullSelection) { - const auto [item, selection] = *selected.cbegin(); + const auto &[item, selection] = *selected.cbegin(); if (const auto view = viewByItem(item)) { return view->selectedText(selection); } diff --git a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp index 984cc0e79..6dcc3497f 100644 --- a/Telegram/SourceFiles/history/view/history_view_list_widget.cpp +++ b/Telegram/SourceFiles/history/view/history_view_list_widget.cpp @@ -901,7 +901,7 @@ not_null ListWidget::enforceViewForItem( return j->second.get(); } } - const auto [i, ok] = _views.emplace( + const auto &[i, ok] = _views.emplace( item, item->createView(this)); return i->second.get(); @@ -1094,7 +1094,7 @@ void ListWidget::repaintScrollDateCallback() { auto ListWidget::collectSelectedItems() const -> SelectedItems { auto transformation = [&](const auto &item) { - const auto [itemId, selection] = item; + const auto &[itemId, selection] = item; auto result = SelectedItem(itemId); result.canDelete = selection.canDelete; result.canForward = selection.canForward; @@ -3766,7 +3766,7 @@ void ListWidget::refreshItem(not_null view) { } return nullptr; }(); - const auto [i, ok] = _views.emplace( + const auto &[i, ok] = _views.emplace( item, item->createView(this, was.get())); const auto now = i->second.get(); diff --git a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp index c08d8fde5..7e96e068f 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_poll.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_poll.cpp @@ -761,7 +761,7 @@ void Poll::draw(Painter &p, const PaintContext &context) const { auto &&answers = ranges::views::zip( _answers, ranges::views::ints(0, int(_answers.size()))); - for (const auto [answer, index] : answers) { + for (const auto &[answer, index] : answers) { const auto animation = _answersAnimation ? &_answersAnimation->data[index] : nullptr; diff --git a/Telegram/SourceFiles/info/media/info_media_common.cpp b/Telegram/SourceFiles/info/media/info_media_common.cpp index fde5dd01b..23fba5eec 100644 --- a/Telegram/SourceFiles/info/media/info_media_common.cpp +++ b/Telegram/SourceFiles/info/media/info_media_common.cpp @@ -39,7 +39,7 @@ bool ChangeItemSelection( return false; }; if (selected.size() < MaxSelectedItems) { - const auto [i, ok] = selected.try_emplace(item, selectionData); + const auto &[i, ok] = selected.try_emplace(item, selectionData); if (ok) { return true; } diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp index c533fd805..3bbc98fb9 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_widget.cpp @@ -1720,7 +1720,7 @@ bool OverlayWidget::stateAnimationCallback(crl::time now) { now += st::mediaviewShowDuration + st::mediaviewHideDuration; } for (auto i = begin(_animations); i != end(_animations);) { - const auto [state, started] = *i; + const auto &[state, started] = *i; updateOverRect(state); const auto dt = float64(now - started) / st::mediaviewFadeDuration; if (dt >= 1) { @@ -5494,12 +5494,12 @@ void OverlayWidget::preloadData(int delta) { for (auto index = from; index != till + 1; ++index) { auto entity = entityByIndex(index); if (auto photo = std::get_if>(&entity.data)) { - const auto [i, ok] = photos.emplace((*photo)->createMediaView()); + const auto &[i, ok] = photos.emplace((*photo)->createMediaView()); (*i)->wanted(Data::PhotoSize::Small, fileOrigin(entity)); (*photo)->load(fileOrigin(entity), LoadFromCloudOrLocal, true); } else if (auto document = std::get_if>( &entity.data)) { - const auto [i, ok] = documents.emplace( + const auto &[i, ok] = documents.emplace( (*document)->createMediaView()); (*i)->thumbnailWanted(fileOrigin(entity)); if (!(*i)->canBePlayed(entity.item)) { diff --git a/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp b/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp index 676aa047c..850d5c6c1 100644 --- a/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp +++ b/Telegram/SourceFiles/mtproto/dedicated_file_loader.cpp @@ -453,7 +453,7 @@ void StartDedicatedLoader( ready(nullptr); }; - const auto [username, postId] = location; + const auto &[username, postId] = location; ResolveChannel(mtp, username, [=, postId = postId]( const MTPInputChannel &channel) { mtp->send( diff --git a/Telegram/SourceFiles/passport/passport_form_controller.cpp b/Telegram/SourceFiles/passport/passport_form_controller.cpp index cf9f4c775..684163163 100644 --- a/Telegram/SourceFiles/passport/passport_form_controller.cpp +++ b/Telegram/SourceFiles/passport/passport_form_controller.cpp @@ -1791,7 +1791,7 @@ void FormController::loadFile(File &file) { return; } file.downloadStatus.set(LoadStatus::Status::InProgress, 0); - const auto [j, ok] = _fileLoaders.emplace( + const auto &[j, ok] = _fileLoaders.emplace( key, std::make_unique( &_controller->session(), @@ -1823,7 +1823,7 @@ void FormController::loadFile(File &file) { } void FormController::fileLoadDone(FileKey key, const QByteArray &bytes) { - if (const auto [value, file] = findFile(key); file != nullptr) { + if (const auto &[value, file] = findFile(key); file != nullptr) { const auto decrypted = DecryptData( bytes::make_span(bytes), file->hash, @@ -1843,7 +1843,7 @@ void FormController::fileLoadDone(FileKey key, const QByteArray &bytes) { } void FormController::fileLoadProgress(FileKey key, int offset) { - if (const auto [value, file] = findFile(key); file != nullptr) { + if (const auto &[value, file] = findFile(key); file != nullptr) { file->downloadStatus.set(LoadStatus::Status::InProgress, offset); if (const auto fileInEdit = findEditFile(key)) { fileInEdit->fields.downloadStatus = file->downloadStatus; @@ -1853,7 +1853,7 @@ void FormController::fileLoadProgress(FileKey key, int offset) { } void FormController::fileLoadFail(FileKey key) { - if (const auto [value, file] = findFile(key); file != nullptr) { + if (const auto &[value, file] = findFile(key); file != nullptr) { file->downloadStatus.set(LoadStatus::Status::Failed); if (const auto fileInEdit = findEditFile(key)) { fileInEdit->fields.downloadStatus = file->downloadStatus; @@ -2591,7 +2591,7 @@ bool FormController::parseForm(const MTPaccount_AuthorizationForm &result) { const auto row = CollectRequestedRow(required); for (const auto &requested : row.values) { const auto type = requested.type; - const auto [i, ok] = _form.values.emplace(type, Value(type)); + const auto &[i, ok] = _form.values.emplace(type, Value(type)); auto &value = i->second; value.translationRequired = requested.translationRequired; value.selfieRequired = requested.selfieRequired; diff --git a/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp b/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp index 9f71e2e3a..c3715e977 100644 --- a/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp +++ b/Telegram/SourceFiles/passport/passport_panel_edit_document.cpp @@ -530,7 +530,7 @@ void PanelEditDocument::createDetailsRow( const auto isoByPhone = Countries::Instance().countryISO2ByPhone( _controller->bot()->session().user()->phone()); - const auto [it, ok] = _details.emplace( + const auto &[it, ok] = _details.emplace( i, container->add(Ui::PanelDetailsRow::Create( container, diff --git a/Telegram/SourceFiles/storage/download_manager_mtproto.cpp b/Telegram/SourceFiles/storage/download_manager_mtproto.cpp index d6752e768..77aae801b 100644 --- a/Telegram/SourceFiles/storage/download_manager_mtproto.cpp +++ b/Telegram/SourceFiles/storage/download_manager_mtproto.cpp @@ -804,8 +804,8 @@ void DownloadMtprotoTask::placeSentRequest( dcId(), requestData.sessionIndex, Storage::kDownloadPartSize); - const auto [i, ok1] = _sentRequests.emplace(requestId, requestData); - const auto [j, ok2] = _requestByOffset.emplace( + const auto &[i, ok1] = _sentRequests.emplace(requestId, requestData); + const auto &[j, ok2] = _requestByOffset.emplace( requestData.offset, requestId); diff --git a/Telegram/SourceFiles/storage/file_upload.cpp b/Telegram/SourceFiles/storage/file_upload.cpp index f2a014f7e..72ebdaafe 100644 --- a/Telegram/SourceFiles/storage/file_upload.cpp +++ b/Telegram/SourceFiles/storage/file_upload.cpp @@ -359,7 +359,7 @@ void Uploader::upload( void Uploader::currentFailed() { auto j = queue.find(uploadingId); if (j != queue.end()) { - const auto [msgId, file] = std::move(*j); + const auto &[msgId, file] = std::move(*j); queue.erase(j); notifyFailed(msgId, file); } @@ -640,7 +640,7 @@ void Uploader::cancelAll() { currentFailed(); } while (!queue.empty()) { - const auto [msgId, file] = std::move(*queue.begin()); + const auto &[msgId, file] = std::move(*queue.begin()); queue.erase(queue.begin()); notifyFailed(msgId, file); } diff --git a/Telegram/SourceFiles/ui/boxes/single_choice_box.cpp b/Telegram/SourceFiles/ui/boxes/single_choice_box.cpp index a75d8a030..2083a0f48 100644 --- a/Telegram/SourceFiles/ui/boxes/single_choice_box.cpp +++ b/Telegram/SourceFiles/ui/boxes/single_choice_box.cpp @@ -29,7 +29,7 @@ void SingleChoiceBox( layout, st::boxOptionListPadding.top() + st::autolockButton.margin.top())); auto &&ints = ranges::views::ints(0, ranges::unreachable); - for (const auto [i, text] : ranges::views::zip(ints, args.options)) { + for (const auto &[i, text] : ranges::views::zip(ints, args.options)) { layout->add( object_ptr( layout, diff --git a/Telegram/SourceFiles/ui/chat/attach/attach_album_thumbnail.cpp b/Telegram/SourceFiles/ui/chat/attach/attach_album_thumbnail.cpp index 3c8f155d6..adf38109b 100644 --- a/Telegram/SourceFiles/ui/chat/attach/attach_album_thumbnail.cpp +++ b/Telegram/SourceFiles/ui/chat/attach/attach_album_thumbnail.cpp @@ -324,7 +324,7 @@ void AlbumThumbnail::drawSimpleFrame(QPainter &p, QRect to, QSize size) const { const auto Round = [](float64 value) { return int(base::SafeRound(value)); }; - const auto [from, fillBlack] = [&] { + const auto &[from, fillBlack] = [&] { if (previewWidth < width && previewHeight < height) { const auto toWidth = Round(previewWidth * scaleWidth); const auto toHeight = Round(previewHeight * scaleHeight); diff --git a/Telegram/SourceFiles/ui/chat/message_bar.cpp b/Telegram/SourceFiles/ui/chat/message_bar.cpp index 47f7056e4..c3cf6e113 100644 --- a/Telegram/SourceFiles/ui/chat/message_bar.cpp +++ b/Telegram/SourceFiles/ui/chat/message_bar.cpp @@ -20,7 +20,7 @@ namespace Ui { namespace { [[nodiscard]] int SameFirstPartLength(const QString &a, const QString &b) { - const auto [i, j] = ranges::mismatch(a, b); + const auto &[i, j] = ranges::mismatch(a, b); return (i - a.begin()); } diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index e0dc8d193..9ab93b934 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -309,7 +309,7 @@ System::Timing System::countTiming( void System::registerThread(not_null thread) { if (const auto topic = thread->asTopic()) { - const auto [i, ok] = _watchedTopics.emplace(topic, rpl::lifetime()); + const auto &[i, ok] = _watchedTopics.emplace(topic, rpl::lifetime()); if (ok) { topic->destroyed() | rpl::start_with_next([=] { clearFromTopic(topic); diff --git a/Telegram/SourceFiles/window/window_session_controller.cpp b/Telegram/SourceFiles/window/window_session_controller.cpp index b4be01c6d..cd537957c 100644 --- a/Telegram/SourceFiles/window/window_session_controller.cpp +++ b/Telegram/SourceFiles/window/window_session_controller.cpp @@ -1243,7 +1243,7 @@ void SessionController::setupShortcuts() { auto &&accounts = ranges::views::zip( Shortcuts::kShowAccount, ranges::views::ints(0, accountsCount)); - for (const auto [command, index] : accounts) { + for (const auto &[command, index] : accounts) { request->check(command) && request->handle([=] { const auto list = app->domain().orderedAccounts(); if (index >= list.size()) {