diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-03-21 15:45:20 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-03-21 15:46:37 +0900 |
commit | 733b5d5ae2c5d625211e2985ac25728ac3f54883 (patch) | |
tree | a5b214744b256f07e1dc2bd7273035a7808c659f /boost/asio/detail/timer_queue.hpp | |
parent | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (diff) | |
download | boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.gz boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.bz2 boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.zip |
Imported Upstream version 1.58.0upstream/1.58.0
Change-Id: If0072143aa26874812e0db6872e1efb10a3e5e94
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/asio/detail/timer_queue.hpp')
-rw-r--r-- | boost/asio/detail/timer_queue.hpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/boost/asio/detail/timer_queue.hpp b/boost/asio/detail/timer_queue.hpp index 1c94bcd987..3ad6a86919 100644 --- a/boost/asio/detail/timer_queue.hpp +++ b/boost/asio/detail/timer_queue.hpp @@ -2,7 +2,7 @@ // detail/timer_queue.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2014 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) @@ -193,13 +193,13 @@ private: // Move the item at the given index up the heap to its correct position. void up_heap(std::size_t index) { - std::size_t parent = (index - 1) / 2; - while (index > 0 - && Time_Traits::less_than(heap_[index].time_, heap_[parent].time_)) + while (index > 0) { + std::size_t parent = (index - 1) / 2; + if (!Time_Traits::less_than(heap_[index].time_, heap_[parent].time_)) + break; swap_heap(index, parent); index = parent; - parent = (index - 1) / 2; } } @@ -246,9 +246,8 @@ private: { swap_heap(index, heap_.size() - 1); heap_.pop_back(); - std::size_t parent = (index - 1) / 2; if (index > 0 && Time_Traits::less_than( - heap_[index].time_, heap_[parent].time_)) + heap_[index].time_, heap_[(index - 1) / 2].time_)) up_heap(index); else down_heap(index); |