From 9cab4d7d3106fb91fe325fe47176f450ccf8a66a Mon Sep 17 00:00:00 2001 From: Alden Torres Date: Fri, 23 Mar 2018 18:04:04 -0400 Subject: [PATCH] using move with bw_request and make sure it is movable --- src/bandwidth_manager.cpp | 6 +++--- src/bandwidth_queue_entry.cpp | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/bandwidth_manager.cpp b/src/bandwidth_manager.cpp index f2bc06148..f7ada6fc7 100644 --- a/src/bandwidth_manager.cpp +++ b/src/bandwidth_manager.cpp @@ -118,7 +118,7 @@ namespace libtorrent { if (k == 0) return blk; m_queued_bytes += blk; - m_queue.push_back(bwr); + m_queue.push_back(std::move(bwr)); return 0; } @@ -165,7 +165,7 @@ namespace libtorrent { } i->assigned = 0; - queue.push_back(*i); + queue.push_back(std::move(*i)); i = m_queue.erase(i); continue; } @@ -201,7 +201,7 @@ namespace libtorrent { { a += i->request_size - i->assigned; TORRENT_ASSERT(i->assigned <= i->request_size); - queue.push_back(*i); + queue.push_back(std::move(*i)); i = m_queue.erase(i); } else diff --git a/src/bandwidth_queue_entry.cpp b/src/bandwidth_queue_entry.cpp index 63c5c546e..8773b5345 100644 --- a/src/bandwidth_queue_entry.cpp +++ b/src/bandwidth_queue_entry.cpp @@ -70,4 +70,9 @@ namespace libtorrent { TORRENT_ASSERT(assigned <= request_size); return quota; } + + static_assert(std::is_nothrow_move_constructible::value + , "should be nothrow move constructible"); + static_assert(std::is_nothrow_move_assignable::value + , "should be nothrow move assignable"); }