Use std::make_move_iterator for adding entries from AppendRequest into a Follower's Raft log

This commit is contained in:
Tyler Neely 2022-08-29 13:24:34 +00:00
parent e67eefb1a3
commit 726c42a3fc

View File

@ -727,7 +727,8 @@ class Raft {
// hasn't reached consensus yet, which is normal)
state_.log.resize(resize_length);
state_.log.insert(state_.log.end(), req.entries.begin(), req.entries.end());
state_.log.insert(state_.log.end(), std::make_move_iterator(req.entries.begin()),
std::make_move_iterator(req.entries.end()));
MG_ASSERT(req.leader_commit >= state_.committed_log_size);
state_.committed_log_size = std::min(req.leader_commit, state_.log.size());