using move with bw_request and make sure it is movable

This commit is contained in:
Alden Torres 2018-03-23 18:04:04 -04:00 committed by Arvid Norberg
parent 5413eae900
commit 9cab4d7d31
2 changed files with 8 additions and 3 deletions

View File

@ -118,7 +118,7 @@ namespace libtorrent {
if (k == 0) return blk; if (k == 0) return blk;
m_queued_bytes += blk; m_queued_bytes += blk;
m_queue.push_back(bwr); m_queue.push_back(std::move(bwr));
return 0; return 0;
} }
@ -165,7 +165,7 @@ namespace libtorrent {
} }
i->assigned = 0; i->assigned = 0;
queue.push_back(*i); queue.push_back(std::move(*i));
i = m_queue.erase(i); i = m_queue.erase(i);
continue; continue;
} }
@ -201,7 +201,7 @@ namespace libtorrent {
{ {
a += i->request_size - i->assigned; a += i->request_size - i->assigned;
TORRENT_ASSERT(i->assigned <= i->request_size); TORRENT_ASSERT(i->assigned <= i->request_size);
queue.push_back(*i); queue.push_back(std::move(*i));
i = m_queue.erase(i); i = m_queue.erase(i);
} }
else else

View File

@ -70,4 +70,9 @@ namespace libtorrent {
TORRENT_ASSERT(assigned <= request_size); TORRENT_ASSERT(assigned <= request_size);
return quota; return quota;
} }
static_assert(std::is_nothrow_move_constructible<bw_request>::value
, "should be nothrow move constructible");
static_assert(std::is_nothrow_move_assignable<bw_request>::value
, "should be nothrow move assignable");
} }