From 45e31a153cf65390041059eb0a524ac296992629 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 5 Jul 2021 15:55:41 +0800 Subject: [PATCH] Reserve space for vector --- src/base/bittorrent/torrentimpl.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 3b86e8ee1..a697bb30e 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -797,7 +797,8 @@ QVector TorrentImpl::filePriorities() const const std::vector fp = m_nativeHandle.get_file_priorities(); QVector ret; - std::transform(fp.cbegin(), fp.cend(), std::back_inserter(ret), [](lt::download_priority_t priority) + ret.reserve(fp.size()); + std::transform(fp.cbegin(), fp.cend(), std::back_inserter(ret), [](const lt::download_priority_t priority) { return static_cast(toLTUnderlyingType(priority)); });