From 61c276172fd7df97194ebcfc3551ab71aa77e5b2 Mon Sep 17 00:00:00 2001 From: paolo Date: Sat, 31 May 2008 23:01:09 +0000 Subject: [PATCH] 2008-05-31 Paolo Carlini Chris Jefferson PR libstdc++/36338 * include/bits/stl_heap.h (sort_heap): Use __pop_heap directly. (pop_heap): Slightly tweak. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136242 138bc75d-0d04-0410-961f-82ee72b054a4 --- libstdc++-v3/ChangeLog | 7 +++++++ libstdc++-v3/include/bits/stl_heap.h | 18 +++++++++++++----- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 261d5e9..614d54c 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2008-05-31 Paolo Carlini + Chris Jefferson + + PR libstdc++/36338 + * include/bits/stl_heap.h (sort_heap): Use __pop_heap directly. + (pop_heap): Slightly tweak. + 2008-05-29 Paolo Carlini * include/debug/bitset (bitset(const char*)): Implement DR 778 diff --git a/libstdc++-v3/include/bits/stl_heap.h b/libstdc++-v3/include/bits/stl_heap.h index bbe76e7..4deafd2 100644 --- a/libstdc++-v3/include/bits/stl_heap.h +++ b/libstdc++-v3/include/bits/stl_heap.h @@ -1,6 +1,6 @@ // Heap implementation -*- C++ -*- -// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 +// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -285,7 +285,8 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __glibcxx_requires_valid_range(__first, __last); __glibcxx_requires_heap(__first, __last); - std::__pop_heap(__first, __last - 1, __last - 1); + --__last; + std::__pop_heap(__first, __last, __last); } template 1) - std::pop_heap(__first, _RandomAccessIterator(__last--)); + { + --__last; + std::__pop_heap(__first, __last, __last); + } } /** @@ -483,7 +488,10 @@ _GLIBCXX_BEGIN_NAMESPACE(std) __glibcxx_requires_heap_pred(__first, __last, __comp); while (__last - __first > 1) - std::pop_heap(__first, _RandomAccessIterator(__last--), __comp); + { + --__last; + std::__pop_heap(__first, __last, __last, __comp); + } } #ifdef __GXX_EXPERIMENTAL_CXX0X__ -- 2.7.4